Algorithm 3.
Reuse-Tree Merging Algorithm(RTMA)
| 1: | Input: stages; maxBucketSize; |
| 2: | Output: bucketList; |
| 3: | bucketList ← ∅; |
| 4: | rTree ← GenerateReuseTree(stages) |
| 5: | while rTree.height > 2 do |
| 6: | leafsPList ← GenerateLeafsParentList(rTree) |
| 7: | newBuckets ← PruneLeafLevel(rTree, leafsPList, maxBucketSize) |
| 8: | insert(newBuckets, bucketList) |
| 9: | MoveReuseTreeUp(reuseTree, leafsPList) |
| 10: | end while |
| 11: | if rTree.rootchildren ≠ ∅ then |
| 12: | newBuckets ← rTree.root.children |
| 13: | insert(newBuckets, bucketList) |
| 14: | end if |
| 15: | return bucketList |