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