We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2d8171b commit 87db7cfCopy full SHA for 87db7cf
data_structures/disjoint_sets/disjoint_sets.rb
@@ -1,4 +1,23 @@
1
-require "./data_structures/disjoint_sets/node.rb"
+class Node
2
+ attr_accessor :data, :parent, :rank
3
+ def initialize(data)
4
+ @data = data
5
+ @parent = self
6
+ @rank = 0
7
+ end
8
+ def parent
9
+ @parent
10
11
+ def parent=(parent)
12
+ @parent = parent;
13
14
+ def rank
15
+ @rank
16
17
+ def rank=(rank)
18
+ @rank = rank
19
20
+end
21
22
class DisjointSets
23
def make_set(d)
data_structures/disjoint_sets/node.rb
0 commit comments