Graph Theory37 sections · 1633 units
Open in Course

Quiz: Lomsat gelral

Knowledge check

Check Your Understanding

Lomsat gelral: For each node, find the most frequent color in its subtree. Naive approach is O(n2)O(n^2). How do you optimize?

  1. A.Small-to-large merging (DSU on tree)
  2. B.Sort colors globally first
  3. C.Binary search on frequencies
  4. D.Use a hash map per node
Start the roadmap to answer the quizzes and solve the challenges