Knowledge in quick sorting: Hall and quick sorting

Source: Internet
Author: User
Sircharlesantonyrichard dhoare is a British computer scientist and inventor of the famous QuickSort. On average, the number of tasks to be sorted must be compared by nlogn times, and it is generally faster than other nlogn algorithms. Therefore, it is a widely used algorithm. In an interview, Hall talked about the background of the algorithm.

The last article introduced the nature of sorting and the implementation of the fast sorting algorithm in Introduction to Algorithms. However, there is not only one algorithm for fast sorting. we need to mine all the good items for fast sorting at a time. So this article allows us to trace the source of quick sorting and learn about the inventor of quick sorting algorithms.

Hall (Hoare)

Sir Charles Antony Richard Hoare, a British computer scientist, is the inventor of the famous QuickSort. On average, the sorting of n projects is faster than that of other explain (n log n) algorithms. Therefore, it is a widely used algorithm. In an interview, Hall talked about the background of the algorithm.

Hall was born in Sri Lanka. He graduated from Oxford University in 1956. In the next two years, he served in the Royal British Navy. His mission was to study modern Russian military and he began to learn Russian. After serving, he entered Moscow University as a graduate student and focused on computer translation. I studied in Moscow for a year. At this time, there was a small science and computer company, Elliott Brothers, who held an exhibition there and Hall translated them. When he returned home, the company immediately hired him, saving him for an interview. They also increased his salary because he can speak Russian. Elliott Brothers asked Hall to design a new computer language. But when he occasionally saw a Report on the Algorithmic Language Algol 60 reported by Alan Petley, he immediately recommended the company to abandon designing a new language and turn it into implementing ALGOL. The company adopted his suggestion. ALGOL is the first language to be clearly defined, and its syntax is illustrated by strictly formulated methods. ALGOL is not widely used, but it is the conceptual basis of many modern programming languages. For him personally, this project not only laid the foundation for his career, but also brought him a sweet marriage: he met and married Jill, a colleague in the same group, and became a talk.

Let's get down to the truth. In the 1960 s, the British National Physical Laboratory began a new plan to automatically translate Russian into English. Just like Hall had this experience, he met Russian Machine Translation experts and published papers on Machine Translation. So he got a job there.

In that age, the Russian-to-English vocabulary list was stored in a long tape in alphabetical order. Therefore, when a Russian sentence needs to be translated, the first step is to sort the words in the sentence in the same order. In this way, the machine can find all the translations only once on the tape. Hall realized that he had to find an algorithm that could implement sorting on computers. The first algorithm he came up with was called "Bubble sorting? (Bubble sort. Although he did not declare that this algorithm was invented by him, he apparently obtained it by himself. He quickly gave up the algorithm because it was slow. What is the average computing complexity theory? O (N2 )? Operation. Quick sorting? (Quicksort) is Hall's second algorithm. What is the computing complexity of this algorithm? O (NLogN)? Operation. When?N? When it is very large, there are obviously fewer steps. This algorithm is one of the seven algorithms in the 20th century, and he himself is called one of the ten Masters influencing the algorithm world. Hall himself thinks this algorithm is the only meaningful algorithm he has ever obtained. Obviously, he is modest. So modest! He has made many achievements in computer language and mathematical logic. For example, Mr. Huang Fuqiang introduced Hall logic? (Hoare logic ). At that time, I said that I had to write an article about Hall. I didn't expect it to be delayed until now.

The Computer History Museum is really a good place to go. Do you still remember what I wrote before "building a poor extension designed before 150? It is also seen there. Professor Wang Shiqiang and Professor Shen Fuxing from the mathematics department of Beijing Normal University have some research on "computing complexity. I first came into contact with the "computing complexity" issue from them.

Back to "quick sorting", in fact, the basic idea of "quick sorting" is to use Recursion. each step divides a large set into two small subsets, then implement the same algorithm for the two subsets. After both subsets are sorted, they are re-bonded together. Let's use the following simple example to briefly describe it.

Suppose we have a group of 10 numbers, and we want to sort them in ascending order. First, we randomly pick out an element from the series, which is called a benchmark ). We place a number smaller than this benchmark on the left and a number larger than this benchmark on the right.

The above is our first step. After this step, we get two small sets. Now we repeat the above steps to sort these two small sets. This is the recursive idea I mentioned earlier. Let's ignore the specific details. After some steps, we have sorted the two small sets. The following two steps are easy to understand.

I have written this story, hoping that software engineers will have some fun learning computing methods. I also hope that the above story and this small example will be helpful to you.

Post-note: In 1991, instructor Yang Zhengyu discovered an adaptive sorting algorithm with an average complexity of O (nloglogn), and the worst time for random numbers with the same distribution is O (n) almost everywhere).

Additional reading

The topic list of this article is as follows:

  1. Knowledge in quick sorting: start with guesses
  2. Knowledge in quick sorting: Let's look at the question of ball.
  3. Knowledge in quick sorting: Information entropy
  4. Knowledge in quick sorting: the process of quick sorting
  5. Knowledge in quick sorting: Hall and quick sorting
  6. Knowledge in quick sorting: Implementation of Hall's fast sorting
  7. Knowledge in quick sorting: Key element selection and algorithm efficiency
  8. Knowledge in quick sorting: randomization fast sorting

Address of this article: http://www.nowamagic.net/librarys/veda/detail/2391,welcome here.

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.