aboutsummaryrefslogtreecommitdiffstats
path: root/csci1913
diff options
context:
space:
mode:
Diffstat (limited to 'csci1913')
-rw-r--r--csci1913/Java/lab12_strap012.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/csci1913/Java/lab12_strap012.java b/csci1913/Java/lab12_strap012.java
index 2db1865..bd46813 100644
--- a/csci1913/Java/lab12_strap012.java
+++ b/csci1913/Java/lab12_strap012.java
@@ -22,14 +22,14 @@ class PriorityQueue<Base> {
if (isEmpty())
throw new IllegalStateException();
Node top = root;
- Node bottom = root.right; //First node is always to the right of the root.
- while (bottom.right != null) { //Find lowest rank
+ Node bottom = root.right;
+ while (bottom.right != null) {
top = bottom;
bottom = bottom.right;
}
-
+ top.right = bottom.right;
+ top.left = bottom.left;
return bottom.object;
-
}
// Unlike the BST’s discussed in the lectures, the nodes in
// each left subtree have ranks less than or equal to the