aboutsummaryrefslogtreecommitdiffstats
path: root/csci1913
diff options
context:
space:
mode:
authorRossTheRoss <msattr@gmail.com>2019-11-25 11:57:42 -0600
committerRossTheRoss <msattr@gmail.com>2019-11-25 11:57:42 -0600
commitaf80bb88cf7cfc16654a75c7154bb90201f36e8d (patch)
tree0016463dad6be1081c198a9472c9f7464c9ee0e2 /csci1913
parentahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh... (diff)
downloadhomework-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 'csci1913')
-rw-r--r--csci1913/Java/project2_strap012.java28
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) {