// Tod Semple // shear.java // import java.awt.*; import java.applet.*; import java.io.*; import java.net.*; import java.lang.*; class shearSort { public int array[][]; int N; shearSort(int N_arg) { N=N_arg; int x,y; array = new int[N][N]; for (x=0;xline[i+1]) swap(line,i,i+1); } void swap(int line[], int a,int b) { done=false; int temp; temp = line[a]; line[a] = line[b]; line[b] = temp; } } class shearSortCanvas extends Canvas { shearSort theSorter; shearSortCanvas(shearSort shearSort_arg) { theSorter = shearSort_arg; } public void paint(Graphics g) { // Clear the canvas g.setColor(Color.white); g.fillRect(0,0,size().width,size().height); int x,y; int xSpacing = size().width/(theSorter.N+1); int ySpacing = size().height/(theSorter.N+1); // draw the zig zag g.setColor(Color.red); for (y=0;y