aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRossTheRoss <msattr@gmail.com>2019-12-05 19:46:18 -0600
committerRossTheRoss <msattr@gmail.com>2019-12-05 19:46:18 -0600
commitce6f01db2b3e7a27048eb04409d2669c04b2ce9f (patch)
tree097647ef298ca81af90a14b3ffded55a8eab605f
parentGet rid of comments (diff)
downloadhomework-ce6f01db2b3e7a27048eb04409d2669c04b2ce9f.tar
homework-ce6f01db2b3e7a27048eb04409d2669c04b2ce9f.tar.gz
homework-ce6f01db2b3e7a27048eb04409d2669c04b2ce9f.tar.bz2
homework-ce6f01db2b3e7a27048eb04409d2669c04b2ce9f.tar.lz
homework-ce6f01db2b3e7a27048eb04409d2669c04b2ce9f.tar.xz
homework-ce6f01db2b3e7a27048eb04409d2669c04b2ce9f.tar.zst
homework-ce6f01db2b3e7a27048eb04409d2669c04b2ce9f.zip
Lab
-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