Pseudocode
BFS
1 | from collections import deque |
DFS
1 | def DFS_working(x): |
Stack and Queue in Python
Using list as stack
1 | 3, 4, 5] stack = [ |
Using list as queue
1 | from collections import deque |
1 | from collections import deque |
1 | def DFS_working(x): |
1 | >>> stack = [3, 4, 5] |
1 | >>> from collections import deque |