School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!
Welcome to Dream.In.Code
Become an Expert!

Join 306,922 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,784 people online right now. Registration is fast and FREE... Join Now!



'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).