Changeset dafbde8 for tests/avltree/avl3.cfa
- Timestamp:
- Jan 20, 2021, 4:49:40 PM (3 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 454f478
- Parents:
- 92bfda0 (diff), fd54fef (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/avltree/avl3.cfa
r92bfda0 rdafbde8 4 4 5 5 // swaps the data within two tree nodes 6 forall( otype K | Comparable(K), otypeV)6 forall(K | Comparable(K), V) 7 7 void node_swap(tree(K, V) * t, tree(K, V) * t2){ 8 8 swap( t->key, t2->key); … … 11 11 12 12 // go left as deep as possible from within the right subtree 13 forall( otype K | Comparable(K), otypeV)13 forall(K | Comparable(K), V) 14 14 tree(K, V) * find_successor(tree(K, V) * t){ 15 15 tree(K, V) * find_successor_helper(tree(K, V) * t){ … … 25 25 26 26 // cleanup - don't want to deep delete, so set children to NULL first. 27 forall( otype K | Comparable(K), otypeV)27 forall(K | Comparable(K), V) 28 28 void deleteSingleNode(tree(K, V) * t) { 29 29 t->left = NULL; … … 33 33 34 34 // does the actual remove operation once we've found the node in question 35 forall( otype K | Comparable(K), otypeV)35 forall(K | Comparable(K), V) 36 36 tree(K, V) * remove_node(tree(K, V) * t){ 37 37 // is the node a leaf? … … 85 85 86 86 // finds the node that needs to be removed 87 forall( otype K | Comparable(K), otypeV)87 forall(K | Comparable(K), V) 88 88 tree(K, V) * remove_helper(tree(K, V) * t, K key, int * worked){ 89 89 if (empty(t)){ … … 106 106 } 107 107 108 forall( otype K | Comparable(K), otypeV)108 forall(K | Comparable(K), V) 109 109 int remove(tree(K, V) ** t, K key){ 110 110 int worked = 0;
Note: See TracChangeset
for help on using the changeset viewer.