- Insertion Sort: The basic operation of insertion sort is to insert a piece of data into an already sorted data set to get a new, one larger ordered data set. The algorithm is suitable for sorting a small amount of data, with a time complexity of O(n^2). It is a stable sorting method. The basic idea of insertion sort is: each step takes a piece of data to be sorted, and according to the size of its key code value, insert it into the appropriate position in the file that has been sorted, until all are inserted.
- Selection Sort: Selection sort (Selection sort) is a simple and intuitive sorting algorithm. Its working principle is to select the smallest (or largest) element from the data elements to be sorted each time, and place it at the beginning of the sequence, until all the data elements to be sorted are completed. Selection sort is an unstable sorting method.
- Bubble Sort: Bubble sort (Bubble Sort) is a relatively simple sorting algorithm in the field of computer science. It repeatedly visits the list to be sorted, compares two elements at a time, and if their order is wrong, they are exchanged. The work of visiting the list is repeated until no more exchanges are needed, that is, the list is sorted. The name of this algorithm comes from the fact that the larger elements will "float" to the top of the list through exchange.
- Quick Sort: Quick sort (Quicksort) is an improvement on bubble sort. Its basic idea is: through a sorting, the data to be sorted is divided into two parts, one of which is all smaller than the other, and then this method is used for quick sort on these two parts of data, the entire sorting process can be carried out recursively, so that the entire data becomes an ordered sequence.
- Merge Sort: Merge sort is an effective sorting algorithm based on merge operations. The algorithm is a very typical application of the divide and conquer method. Merge the already ordered subsequences to get a completely ordered sequence; that is, first make each subsequence ordered, and then make the subsequence segments ordered. If two ordered tables are merged into one ordered table, it is called two-way merge.
- Shell Sort: Shell sort (Shell Sort) is a kind of insertion sort. Also known as reduced increment sort, it is a more efficient improved version of the direct insertion sort algorithm. Shell sort is an unstable sorting algorithm. Shell sort is to group the records according to a certain increment of the index, and use the direct insertion sort algorithm for sorting on each group; as the increment gradually decreases, each group contains more and more keywords, and when the increment is reduced to 1, the entire file is just divided into one group, and the algorithm ends.
This tool is made by Professor David Galles of the University of San Francisco using HTML5+js for data structure animation courseware in the animation comparison part of the algorithm. The professor uses JS+HTML5 Canvas technology to demonstrate the basic principles of six mathematical sorting algorithms, which introduces mathematical knowledge and makes this teaching interesting. Through this tool, we can use the form of animation demonstration to understand the specific execution process of the above insertion sort, selection sort, bubble sort, quick sort, merge sort, shell sort, and other sorting algorithms more intuitively.