@@ -7,6 +7,9 @@ discard block |
||
| 7 | 7 | public $rank; |
| 8 | 8 | public $data; |
| 9 | 9 | |
| 10 | + /** |
|
| 11 | + * @param integer $rank |
|
| 12 | + */ |
|
| 10 | 13 | public function __construct($rank, $data) { |
| 11 | 14 | $this->parent = null; |
| 12 | 15 | $this->rank = $rank; |
@@ -32,6 +35,10 @@ discard block |
||
| 32 | 35 | return $node->parent; |
| 33 | 36 | } |
| 34 | 37 | |
| 38 | + /** |
|
| 39 | + * @param DisjointNode $x |
|
| 40 | + * @param DisjointNode $y |
|
| 41 | + */ |
|
| 35 | 42 | public function union($x, $y) { |
| 36 | 43 | $rootX = $this->find($x); |
| 37 | 44 | $rootY = $this->find($y); |