diff options
author | RossTheRoss <msattr@gmail.com> | 2019-11-25 11:57:42 -0600 |
---|---|---|
committer | RossTheRoss <msattr@gmail.com> | 2019-11-25 11:57:42 -0600 |
commit | af80bb88cf7cfc16654a75c7154bb90201f36e8d (patch) | |
tree | 0016463dad6be1081c198a9472c9f7464c9ee0e2 | |
parent | ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh... (diff) | |
download | homework-af80bb88cf7cfc16654a75c7154bb90201f36e8d.tar homework-af80bb88cf7cfc16654a75c7154bb90201f36e8d.tar.gz homework-af80bb88cf7cfc16654a75c7154bb90201f36e8d.tar.bz2 homework-af80bb88cf7cfc16654a75c7154bb90201f36e8d.tar.lz homework-af80bb88cf7cfc16654a75c7154bb90201f36e8d.tar.xz homework-af80bb88cf7cfc16654a75c7154bb90201f36e8d.tar.zst homework-af80bb88cf7cfc16654a75c7154bb90201f36e8d.zip |
Hoisting the white flag of surrender
Diffstat (limited to '')
-rw-r--r-- | csci1913/Java/project2_strap012.java | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/csci1913/Java/project2_strap012.java b/csci1913/Java/project2_strap012.java index ae4be3f..d8e10ee 100644 --- a/csci1913/Java/project2_strap012.java +++ b/csci1913/Java/project2_strap012.java @@ -83,30 +83,28 @@ class Sort { Node end = null; if (left.number < right.number) { Node temp = left.next; - sorted=left; - end = left; + sorted = left; end = left; left.next = null; left = temp; end.next = null; - } else if (right.number > left.number) { + } else { Node temp = right.next; - end = right; - sorted = right; - right.next =null; + end = right; sorted = right; + right.next = null; right = temp; end.next = null; } while (left != null && right != null) { - if (left.number > right.number) { - right.next = end; - Node temp = right.next; - right.next = null; - end = temp; - } else { - left.next = end; + if (left.number < right.number) { Node temp = left.next; - left.next = null; - end = temp; + end = left; + right = temp; + end.next = null; + } else { + Node temp = right.next; + end = right; + right = temp; + end.next = null; } } if (left == null) { |