diff --git a/Assignment10/bin/RecursiveExercise.class b/Assignment10/bin/RecursiveExercise.class index 517ee7f..9dec825 100644 Binary files a/Assignment10/bin/RecursiveExercise.class and b/Assignment10/bin/RecursiveExercise.class differ diff --git a/Assignment10/src/RecursiveExercise.java b/Assignment10/src/RecursiveExercise.java index 9ef8d7d..066eea1 100644 --- a/Assignment10/src/RecursiveExercise.java +++ b/Assignment10/src/RecursiveExercise.java @@ -61,12 +61,9 @@ public class RecursiveExercise { if(ht==null)return null; if(n==0)return ht; int temp = ht[0]; - ht = insertLast(temp,MyArrayUtil.tail(ht)); + ht = reverse(MyArrayUtil.addAsFirst(temp, reverse(MyArrayUtil.tail(ht)))); return shift(ht,n-1); } - public static int[] insertLast(int val,int[] ia) throws Exception{ - return reverse(MyArrayUtil.addAsFirst(val, reverse(ia))); - } public static void main(String[] args) throws Exception { // test append, when appending empty array with {1,2,3} int[] a = null;