()
| 85 | |
| 86 | // Fast-path Find from the Union-Find algorithm |
| 87 | LRG find() { |
| 88 | if( _leader==null ) return this; // I am the leader |
| 89 | if( _leader._leader==null ) // I point to the leader |
| 90 | return _leader; |
| 91 | return _rollup(); |
| 92 | } |
| 93 | // Slow-path rollup of U-F |
| 94 | private LRG _rollup() { |
| 95 | LRG ldr = _leader._leader; |
no test coverage detected