"Quick sort" algorithm understood by illustration
Computer scientist'sAntony HoaA sort algorithm developed by Mr. at the age of 26 is "Quick sort"is. A page that explains with an illustration so that it is easier to imagine how this quicksort works is "Illustrated Quicksort algorithmSo, what sorting is done is intuitively easy to understand.
Illustrated Quicksort algorithm
https://illustrated-algorithms.now.sh/quicksort
It's easy to use, just click on "start" OK. After that, the illustrations automatically displayed on the left side of the screen are sorted, so you can understand the quick sorting algorithm by keeping track of it. On the right of the screen is written a code to sort fruits alphabetically using Quick Sort ... ....
When you click "start", the top of the screen is highlighted in white at the top of the screen so that you can see the position of the code being executed.
First select appropriate value "pivot" from fruit. It was "PEACH (peach)" that was chosen.
And it is alphabetically ordered (LESS) than "PEACH (peach)" ...
I will divide what is after (GREATER) in alphabetical order.
Then, from among the four fruits that come out ahead (LESS) in alphabetical order than "PEACH (peach)" ...
Select "pivot" again. This time "KIWI (kiwi)" was chosen ... ...
It chooses whether the alphabetical order is before or after the kiwi. Now all three other fruits were in alphabetical order (LESS).
Therefore, those after alphabetical order (GREATER) are not applicable.
Then sort again the three fruits classified as LESS in alphabetical order.
Pivot at "GRAPES (grapes)" ...
The other two are in alphabetical order (LESS), those in alphabetical order after (GREATER) are not applicable.
And the last two sort in the same way ......
The order of the two fruits is determined. Because the two petals of the fruit were "GRAPES (grapes)" ....
"GRAPES (grapes)" placed after the two. This determines the order of the three fruits.
By going back one step at a time just like this ...
Finally, the order of six fruits is determined.
Although there are changes in the procedure depending on the number of items to be sorted and the order, basically it is the quicksort that the sorting proceeds in the same order as this.
Related Posts:
in Software, Posted by logu_ii