Html5 quick sorting demonstration and Html5 sorting demonstration
Quicksort is an improvement in Bubble sorting. Quick sorting was proposed by C. A. R. Hoare in 1962.
- Its basic idea is to sort the data to be sorted by a click.SplitInto two independent parts. All the data in one part is smaller than all the data in the other part, and then sort the data in this way, the entire sorting process can be performed recursively to convert the entire data into an ordered sequence.
- Fast sorting is not a stable sorting algorithm. That is to say, the relative positions of multiple identical values may change at the end of the algorithm.
- Each time you try to select an element that can represent the value as the key data, and then compare, replace, and Recursion according to the general fast sorting principle.
- The average running time of quick sorting is O (nlogn ).
Certificate -----------------------------------------------------------------------------------------------------------------------------------------
Shows the demo:
The algorithm principle is not described in detail. The specific code is as follows:
1 <! DOCTYPE html> 2 View Code
Quick Sorting Algorithm and optimization solution: