Daa Decode
Daa Decode
alj] ) then,// i has few nodes than j {. ali} =j // {becomes parent of 1 ali] = temp ; } t else Messer or equal to condition { . ali) =i Wibecomes parent of j all] = temp _Searching and Traversal Techniques _ Algorithm using collapsing rule - Definition Collapsing Rule : If j is a node on the path from i to its root and a[i) # root [i] then set afj] to root [i]. Using collapsing rule, the find operation can be performed. |For example [Step 1: Consider a tree of unions, Now we will find 6 using collapsing rule, Q ® QO @ Let, root = 1 Step 2 itemp = parent[6] |As root | = temp i.e. 145 Step 3: JAgain root | = temp ie. 1#5 Set temp = parent { temp } Step 4: Again root | = temp ie. 143 Sot temp ='parent | temp ] fomp_= 1 Step 5 : [Now root=temp ie. 1=1. return root ie. 1 Step 6: Thus we can find (6) as 6-95-31 ‘Seamed nth CamScanner