aboutsummaryrefslogtreecommitdiffstats
path: root/csci1913
diff options
context:
space:
mode:
authorRossTheRoss <msattr@gmail.com>2019-11-25 11:29:18 -0600
committerRossTheRoss <msattr@gmail.com>2019-11-25 11:29:18 -0600
commit74133636f9594cd6bc5f0432de69eadbe6854841 (patch)
treedc3f968747388390eeea3656d183f75d85594736 /csci1913
parentI've done nothing send help (diff)
downloadhomework-74133636f9594cd6bc5f0432de69eadbe6854841.tar
homework-74133636f9594cd6bc5f0432de69eadbe6854841.tar.gz
homework-74133636f9594cd6bc5f0432de69eadbe6854841.tar.bz2
homework-74133636f9594cd6bc5f0432de69eadbe6854841.tar.lz
homework-74133636f9594cd6bc5f0432de69eadbe6854841.tar.xz
homework-74133636f9594cd6bc5f0432de69eadbe6854841.tar.zst
homework-74133636f9594cd6bc5f0432de69eadbe6854841.zip
It's still borked
Diffstat (limited to '')
-rw-r--r--csci1913/Java/project2_strap012.java36
1 files changed, 29 insertions, 7 deletions
diff --git a/csci1913/Java/project2_strap012.java b/csci1913/Java/project2_strap012.java
index 625d44c..19a7733 100644
--- a/csci1913/Java/project2_strap012.java
+++ b/csci1913/Java/project2_strap012.java
@@ -79,18 +79,40 @@ class Sort {
left = sortNodes(left);
right = sortNodes(right);
//Combining phase
+ Node end = null;
+ if (left.number < right.number) {
+ Node temp = left.next;
+ sorted=left;
+ end = left;
+ left.next = null;
+ left = temp;
+ end.next = null;
+ } else if (right.number > left.number) {
+ Node temp = right.next;
+ 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;
+ Node temp = left.next;
+ left.next = null;
+ end = temp;
}
}
- if (left == null) {
- sorted.next=right;
- } else {
- sorted.next=left;
- }
+ // if (left == null) {
+ // sorted.next=right;
+ // } else {
+ // sorted.next=left;
+ // }
return sorted;
}