cocktail-sort

bidirectional bubble sort

Here is the code for shacker sort or bidirectional bubble sort. Something is wrong. Error is java.lang.ArrayIndexOutOfBoundsException Can anybody help me? public class bidirectional{ public static void main(String[]args){ int x[]=new int[]{12,9,4,99,120,1,3,10}; int j; int n=x.length; int st=-1; while (st<...

Cocktail Sort code segfaults - not sure why.

Hi there. I wrote a Cocktail Sort algorithm, and am testing it by generating random vectors of size 500 up to 10,000 - running it 10 times per vector. After about the 2000-3000 length vector mark, the code segfaults. I expect it isn't the test code as the same test is used for multiple sorting algorithms and it runs fine for every other ...