Relative Content

Tag Archive for data-structuresiterationgraph-theorydepth-first-search

Space Optimization for Iterative Depth-First-Search (DFS)

Problem In most academic literature, the preferred DFS algorithm is always recursive, however, for large Graphs, an iterative variation using a Stack seems much more practical to me, without running any stack-overflow dangers. It seems however somehow daunting to find an iterative implementation that correctly mimics the behaviour of the recursive one, guaranteeing a O(|V|) […]