Loading

- The basic idea of bubble sort to is compare two neighboring values in an array and swap them if they are out of order. The process gradually place items in their properly position beginning with the greatest value in the array being placed in the highest position. Iteratively apply the same process will eventually arrange all elements in the arrays in order. This method is the least efficient.
- Insertion sort picks up an element from an input array (from the lowest to the highest position) and insert it in the sorted output array in the position such that the sorted order is preserved. This method is slightly more efficient than bubble sort.
- Shell sort starts with a comparison (and swap) interval of one half of the array. Rounds of comparisons with this interval are repetitively performed until no more swaps are required. Then the comparison interval is halved. This process is repeated until the interval is one and no more swaps are required. Shell sort is much more efficient than the preceding two methods.
- Quick sort seeks to find the proper position for a pivotal element. After reaching its final destination, all elements on its left are smaller and on its right are greater than this pivotal element. The same process can be used to sort elements on both sides the pivotal element. When properly implemented, quick sort is the most efficient method among the four algorithms described in this appendix.