我有一个 dfs 方法将返回向量列表,如何根据向量的长度对元素进行排序。
(define (dfs path) ;path store vector index, start from 0
(cond
((dfsStack' empty?)(newline))
(else (set! currentPath (dfsStack' pop!))
(findLast (car currentPath) 0)
(checkUnvisited (cdr (vector-ref network lastNum)))
(cond
((eq? lastName reach) ;reach point
(duplicate path)
(dfs (+ path 1)) ;continue dfs to find next path
)
((and (not (eq? lastName reach))(eq? unvisited #t)) ;no more neighbours
(dfs path)
)
((and (not (eq? lastName reach))(eq? unvisited #f)) ;found the neighbours
(pushStack lastNeighbours currentPath)
(dfs path)
)
);//end cond
)
);//end cond
);//end dfs