algs4-py
algs4-py copied to clipboard
Implement non-recursive version of DFS
It is tested and its output is identical with the normal DFS.
Note: I added peek()
method to Stack
class to use it in this iterative version of DFS (as in the original textbook's Stack API)