algorithm - Union-Find: retrieve all members of a set efficiently -
i'm working union-find algorithm. in first part of program, algorithm computes partition of big set e . after that, want retrieve members of set s , contains given node x . until now, naively, testing membership of elements of e set s . yesterday reading "introduction algorithms" (by clrs, 3rd edition, ex. 21.3-4), and, in exercises, found that: suppose wish add operation print-set(x) , given node x , prints members of x 's set, in order. show how can add single attribute each node in disjoint-set forest print-set(x) takes time linear in number of members of x 's set, , asymptotic running times of other operations unchanged. "linear in number of members of x 's set" great improvement problem! so, i'm trying solve exersice... , after unsuccessful tries, i'm asking on stack overflow! recall union-find implemented upside-down tree, each set s = {v 1 , v 2 , ..., v n }, have v n - 1 edges, have same root (o...