Graph Theory37 sections · 1633 units
Open in Course

Quiz: Path Compression

Knowledge check

Check Your Understanding

You call find(x) on a chain of 1,0001{,}000 nodes: xa1a2rootx \to a_1 \to a_2 \to \cdots \to \text{root}. After this single call, what is the depth of node xx?

  1. A.1,0001{,}000, unchanged
  2. B.500500, because compression halves the chain
  3. C.log(1,000)10\log(1{,}000) \approx 10
  4. D.11, because xx now points directly to the root
Start the roadmap to answer the quizzes and solve the challenges