AlgoBazaAlgoBaza
Back to algorithms

Pre-order List

The pre-order list algorithm records vertices in the order they are first discovered by DFS — each vertex is added to the list upon entry, BEFORE checking neighbors.

Sredni
O(V+E)O(V)OIJOI
Select programming language
Choose the language to see the pre-order list implementation.
Select example
Small, Medium, and Large show recursion code generation. Very large shows only the call stack.

Pre-order List (Python): Small graph (5 vertices, DAG)

1/0
1.0x