From ce6f01db2b3e7a27048eb04409d2669c04b2ce9f Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Thu, 5 Dec 2019 19:46:18 -0600 Subject: Lab --- csci1913/Java/lab12_strap012.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'csci1913') 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 { 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 -- cgit v1.2.3