Content deleted Content added
m minor grammar fix |
m →Finding set representatives: Add forgotten "of" |
||
Line 80:
'''end function'''
This implementation makes two passes, one up the tree and one back down. It requires enough scratch memory to store the path from the query node to the root (in the above pseudocode, the path is implicitly represented using the call stack). This can be decreased to a constant amount of memory by performing both passes in the same direction. The constant memory implementation walks from the query node to the root twice, once to find the root and once to update pointers:
'''function''' Find(''x'') '''is'''
|