1. Engineering
  2. Computer Science
  3. karen has a new way to do path compression in...

Question: karen has a new way to do path compression in...

Question details

Karen has a new way to do path compression in a tree-based union/find partition data structure starting at a node v. She puts all the nodes that are on the path from v to the root in a set S. Then she scans through S and sets the parent pointer of each node in S to its parents parent pointer (assume that the parent pointer of the root points to itself). If this pass changed the value of any nodes parent pointer, then she repeats this process, and goes on repeating this process until she makes a scan through S that does not change any nodes parent value. Show that Karens algorithm is correct and analyze its running time for a path of length h (20%)

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution