What's Here?
- Members: 306,922
- Replies: 841,381
- Topics: 140,586
- Snippets: 4,465
- Tutorials: 1,166
- Total Online: 1,784
- Members: 87
- Guests: 1,697
|
's Contributions
|
Below are the tutorials, code snippets, and resources has submitted to dream.in.code. For more information on Kudos and contributing to dream.in.code visit: http://home.dreamincode.net/?p=about#kudos.
|
|
Tutorials
No Tutorials Submitted. |
|
Code Snippets
|
 |
|
|
Submitted: October 8, 2009
Views: 85
Union-Find Data structure.
By calling the makeUnionFind(S) a one element set is made for every object s contained in S
Objects are stored within Records which are put in trees. A Set can be recognised
by a toplevel record (with a parent pointing to null)
This not a general "Set handling" class, but made for being used with for example
Kruskal's Algortihm.
See http://en.wikipedia.org/wiki/Disjoint-set_data_structure for more info!
Implements makeUnionFind(S) in O(n), Union in O(log n), or O(1) if you a record representing a set, and find(u) called n times yieald an amortized running time of per calling of O(a(n)) ~= O(1).
|
|
|
| |