|
From: Brendan M. <mc...@us...> - 2006-08-06 19:02:49
|
Update of /cvsroot/jigs/jigs/src/edu/whitman/halfway/util In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv21205/src/edu/whitman/halfway/util Modified Files: MiscUtil.java Log Message: Index: MiscUtil.java =================================================================== RCS file: /cvsroot/jigs/jigs/src/edu/whitman/halfway/util/MiscUtil.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** MiscUtil.java 6 Aug 2006 01:27:18 -0000 1.21 --- MiscUtil.java 6 Aug 2006 19:02:46 -0000 1.22 *************** *** 23,31 **** public static final void reverse(int[] a){ ! for(int i=0, j=a.length-1; i<a.length; i++, j--){ int temp = a[i]; a[i] = a[j]; a[j] = temp; } } --- 23,34 ---- public static final void reverse(int[] a){ ! //System.out.println("Reversing " + toString(a)); ! //dividing a.length by 2 is important, otherwise does nothing! ! for(int i=0, j=a.length-1; i<a.length/2; i++, j--){ int temp = a[i]; a[i] = a[j]; a[j] = temp; } + //System.out.println("reverse = " + toString(a)); } *************** *** 1011,1014 **** --- 1014,1018 ---- BitVector bv = new BitVector(n); for(int i=0; i<n; i++){ + if(a[i] < 0 || a[i] >= n) return false; bv.set(a[i]); } |