BFS versus DFS for Fixed-Level Targets in Ordered Trees
Stoyan Ivanov Dimitrov, Martin Minchev, Yan Zhuang
Dartmouth College · Sofia University "St. Kliment Ohridski"
Key points
From the paper's conclusion- We find the average time complexity of the breadth-first search (BFS) and the depth-first search (DFS) algorithms, when one searches for a target node selected uniformly at random among all nodes at level in the set of ordered trees with edges.
Abstract
Abstract. We find the average time complexity of the breadth-first search (BFS) and the depth-first search (DFS) algorithms, when one searches for a target node selected uniformly at random among all nodes at level in the set of ordered trees with edges. Intuition suggests that on average BFS must be asymptotically faster than DFS if and only if, as a function of, is below a certain threshold. We confirm this intuition by showing that there exists a unique constant, such that in expectation BFS is asymptotically faster than DFS if and only if. This gives us a practical rule to select between the two algorithms, even when we do not know the exact value of, but only an estimate of it. Furthermore, we find the asymptotic average time complexity of BFS in the given setting for an arbitrary class of Galton–Watson trees, which includes ordered trees, binary trees, and other popular classes. We use results on the occupation measure of Brownian excursions, as well as combinatorial identities related to lattice paths. Finally, we consider the simple truncated DFS algorithm, which can be shown easily to be asymptotically faster than both BFS and DFS when is known in advance. We show that in fact its asymptotic time complexity is of the asymptotic complexity of BFS, when for any constant. Several further questions are also raised.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Optimal Pattern-Avoidance Bounds for Binary Search TreesarXiv · 2026
- A Sublogarithmic Competitive Algorithm for Online Graph ExplorationarXiv · 2026
- Faster Directed SSSP on Digraphs with Random Sparse Supports or Few DFS ExceptionsarXiv · 2026
- Instance-Optimality of Bidirectional Dijkstra on Simple GraphsarXiv · 2026
- Practical Threshold-based Tree Edit Distance Lower-BoundsarXiv · 2026
- Finite Sample Complexity Analysis of Binary SegmentationAlgorithms · 2026