Summary of Python sorting algorithms

Pig brother 66 2020-11-13 07:36:12
summary python sorting algorithms

Click the corresponding title to jump to the corresponding article

One 、 Introduction to sorting

The first part introduces the concept of sorting ： Comparative 、 stability 、 Complexity , Let's have a simple understanding of sorting .

Two 、Python Implement five kinds of sorting

Separately from the process diagram 、 Algorithmic thought 、 Code implementation and algorithm analysis four directions to introduce how to use Python Realization Bubbling 、 choice 、 Insert 、 hill 、 Merge five sorts .

3、 ... and 、 A line of code to achieve fast arrangement

Because of the importance of fast platoon , So I'm going to talk about it alone , Hurry up is an interview or A sort algorithm with the highest frequency in the exam , It's the idea of divide and conquer algorithm , It works well for large-scale data sorting , But the efficiency of basic ordered data set is not as high as inserting and sorting , So fast scheduling optimization ：
For large-scale data, use fast data first , And then sort by insert .

Four 、 Test the sorting performance

The above is an introduction to 6 Sort of sort ： Bubbling 、 choice 、 Insert 、 hill 、 Merger 、 Quick line up .

What about this 6 Who is the fastest in seed sorting ？ Brother pig designed an experiment and measured one ！ The students who want to know the result check the article by themselves ！

5、 ... and 、 Other sort
At present, brother pig only introduces in detail Python Six sorting algorithms are implemented , There are four kinds of sorting algorithm will be introduced later ！