This is BubbleX !!! An applet appears here if you have a Java-enabled browser.

  Shearsort Algorithm

           Shearsort is a classical sorting algorithm working in rounds on 2-dimensional meshes of processors. Its elementary and elegant runtime analysis can be found in various textbooks. The basic idea of shearsort is to arrange the data into rows and columns in a gird allowing us to sort those rows and columns concurrently.
           Let's assume for now that N is a perfect square. We organize the elements into an array of cells sqrt(N) by sqrt(N). On each sorting pass, we alternately sort rows and columns (pass 1 for rows, pass 2 for columns, pass 3 for rows, and so on). We sort odd numbered rows from left to right and sort even numbered rows from right to left.


Usage :

1) Enter the command line, and click on the "Command set?" button.
2) Click on the "Start" button
3) Use the "Faster" and "Slower" buttons to control the speed.
4) Use the "Single Step On/Off" button to toggle the single step mode, and use the "Step" button to go one step in the single step mode.
Parameters :

     n     size of matrix of n X n data (up to 10)
     r      range of data
     p     
number of processors             (upto 10)
     m   mode
          0 - random data
          1 - decreasing ordered data