From 74133636f9594cd6bc5f0432de69eadbe6854841 Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Mon, 25 Nov 2019 11:29:18 -0600 Subject: It's still borked --- csci1913/Java/project2_strap012.java | 36 +++++++++++++++++++++++++++++------- 1 file 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; } -- cgit v1.2.3