Graph Theory37 sections · 1633 units
Open in Course

Lomsat gelral - Walkthrough

(Example execution)

Tree: node 11 (color 11) has children 22 (color 11) and 33 (color 22). Node 22 has child 44 (color 33). Process 44: map = {33:11}, max = 11, sum = 33. Process 22: take map from 44. Add color 11. Map = {33:11, 11:11}, max = 11, sum = 33+11 = 44.

Process 33: map = {22:11}, max = 11, sum = 22. Process 11: take map from child 22 (size 2>12 > 1). Merge {22:11} from child 33. Add color 11. Map = {33:11, 11:22, 22:11}. Max = 22, sum = 11 (only color 11 has frequency 22).