iterative insert
| 123 | |
| 124 | // iterative insert |
| 125 | void insert(alloc_node* entry) |
| 126 | { |
| 127 | if (!Root) { |
| 128 | Root = entry; |
| 129 | return; |
| 130 | } |
| 131 | |
| 132 | alloc_node* tmp = Root; |
| 133 | alloc_node* prev = 0; |
| 134 | |
| 135 | if (lookup(tmp, entry, prev)) |
| 136 | assert(0); // duplicate |
| 137 | |
| 138 | if (entry < prev) |
| 139 | prev->left_ = entry; |
| 140 | else |
| 141 | prev->right_ = entry; |
| 142 | } |
| 143 | |
| 144 | |
| 145 | alloc_node* predecessorSwap(alloc_node* del) |
no test coverage detected