Union Find Review (Part 1)

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/15

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

16 Terms

1
New cards

What does Union-find track?

It tracks which items are connected and models groups that merge over time.

2
New cards

What are the 3 best use-cases for Union-find?

  • Modeling Networks

  • Clustering

  • Spreading information

3
New cards

What does find(x) do?

It returns the root of an element, x.

4
New cards

What does union(A,B) do?

Merges the set containing element A with the set containing element B.

5
New cards

What's the difference between Fast find and Fast union?

Fast find directly connects every element in a group to its root while Fast union merges 2 groups together to create a “super-group”.

6
New cards

How fast/slow is union() and find() in Fast Find?

find() is fast and union() is slow because it scans everything.

7
New cards

How fast/slow is union() and find() in Union Find?

find() is slow because it needs to trace the root and union() is fast.

8
New cards

What do “Nodes” represent in Union-find?

The people or devices.

9
New cards

What do “interactions” represent in Union-find?

Every time you merge groups using union().

10
New cards

Is it true that once one member of a group is updated, the entire component is considered updated?

Yes, this is possible through Union-find.

11
New cards

Does union-find tell you the order or speed of which an update spreads?

No, it only tells you the connections.

12
New cards

What are the 3 main limitations of Union-find?

  • Every connection is the same, neither one has any significance over others.

  • There’s no way to separate groups after they’ve merged.

  • It only tells you if elements are connected or not.

13
New cards

What is the efficiency (aka time complexity) of Fast-find for find and union?

  • O(1) finds

  • O(n) unions.

14
New cards

What is the worst case efficiency (aka time complexity) of Fast-union for find and union?

Both finds and unions are O(n)

15
New cards

What is the best case efficiency (aka time complexity) of Fast-union for find and union?

Both finds and unions are O(log n)

16
New cards

Can you interpret a data[] array (for either implementation) and understand the number and membership of the groups?

Yes, in fast find, Group IDs with the same data[] values are part of the same group.

In Fast union, you need to trace Group IDs to its root using data[] values, but both implementations still give you groups.