Fast Sort (Quicksort) JavaScript implementation

Source: Internet
Author: User
Tags sort

Japanese programmer Norahiko, wrote a sort algorithm animation demo, very interesting.

This weekend, I use it as a textbook, a good study of a variety of sorting algorithms.

The sorting algorithm (sorting algorithm) is one of the oldest and most basic topics in computer science. To be a qualified programmer, you must understand and master all sorts of sorting algorithms.

At present, the most common sort algorithm is about seven or eight kinds, among which "quick sort" (Quicksort) is used most widely and faster. It is the Turing Prize winner C. A. R. Hoare (1934--) was presented at 1960.

The idea of "quick sort" is simple, and the whole sort process takes only three steps:

(1) In the dataset, select an element as the "datum" (pivot).

(2) All elements less than "datum" are moved to the left of the datum, and all elements greater than "datum" are moved to the right side of the datum.

(3) for the two subsets to the left and right of the "datum", repeat the first and second steps until all subsets are left with only one element.

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/script/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.