Graph Theory37 sections · 1633 units
Open in Course

Table Dimensions

(How many columns needed)

The table has nn rows (one per node) and log2n\lceil \log_2 n \rceil columns (one per power of 22 up to nn). Why logn\log n columns?

Because the maximum jump is n1n-1 (from a leaf to the root), and 2log2nn2^{\lceil \log_2 n \rceil} \geq n. You do not need columns for larger powers. Total space: O(nlogn)O(n \log n). For n=100,000n = 100,000, that is about 100,000×17=1.7100,000 \times 17 = 1.7 million entries.

Totally manageable.