Graph Theory37 sections · 1633 units
Open in Course

Check Your Understanding

(Complexity analysis)

Quick complexity check: what is the time complexity of preprocessing the Euler tour?

Answer: O(n)O(n) for the DFS traversal. What is the space complexity?

Answer: O(n)O(n) for the tintin and touttout arrays, plus whatever data structure you layer on top. What about query time?

That depends on your data structure. Segment tree gives O(log⁡n)O(\log n) per query. Fenwick tree also gives O(log⁡n)O(\log n). The Euler tour itself adds no extra cost beyond the initial O(n)O(n) preprocessing.