Run Code  | API  | Code Wall  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

BFS DFS stack vs recursive

Language: Layout:
+ ] Show input
Compilation time: 0,14 sec, absolute running time: 0,13 sec, cpu time: 0,12 sec, average memory usage: 15 Mb, average nr of threads: 3 
edit mode |  history  | discussion
Following is Breadth First Traversal (starting from vertex 1)
1
2
3
4
5
6
7
8
9
10
11
12
Following is Depth First Traversal (starting from vertex 1)
1
4
8
7
12
11
3
2
6
5
10
9
Following is Depth First Traversal USING RECURSION (starting from vertex 1)
1
2
5
9
10
6
3
4
7
11
12
8

    
                
λ
.NET NoSQL database for rapid development