Tree Traversal without Recursion

  • These methods are the best way to visit every node non-recursively.
  • Time complexity: O(V + E) where V = vertexes and E = edges

Breadth First Search

  • Queue
  • Usually uses more memories
  • Finding a path using BFS is usually the shorter path

Depth First Search

  • Stack

results matching ""

    No results matching ""