Python language sorting algorithm what? Python classes!

It education for old boys 2021-02-23 11:29:44
python language sorting algorithm python


Sequencing is a skill that every software development engineer needs to master , contain Python It's the same with engineers , that Python What are the sorting algorithms ? Common sorting algorithms are divided into insertion sorting 、 Shell Sort 、 Selection sort 、 Bubble sort 、 Quick sorting, etc , Next, follow Xiaobian to have a deep understanding .

Bubble sort

It is a simple and intuitive sorting algorithm , Repeated visits to the sequence to be sorted , Compare two elements at a time , If they're in the wrong order, exchange them . The job of the interview sequence is to repeat until there is no need to exchange , That is to say, the sequence has been sorted , The name of this algorithm comes from the fact that smaller elements will float to the top of the sequence through exchange .

Insertion sort

Its principle should be the easiest to understand , Because anyone who has played poker should be able to understand in seconds . Insert sort is the simplest and most intuitive sort algorithm , It works by building an ordered sort , For unsorted data , Scan backward and forward in sorted series , Locate and insert .

Shell Sort

Also known as the descending incremental sort algorithm , Is a more efficient version of insert sorting , But Hill sort is an unstable sort algorithm . Hill sort is based on the following two properties of insertion sort : Insert sort is used to manipulate almost ordered data , Efficient , That is, the efficiency of linear sorting can be achieved ; But insertion sorting is generally inefficient , Because insertion sorting can only move data one bit at a time .

Merge sort

It is an effective sorting algorithm based on merge operation , This algorithm is a very typical application of divide and conquer method , Algorithm application as a typical idea of divide and rule .

Quick sort

The quick sort is by Tony · A sort algorithm developed by Hall . On average , Sort n Item to be Ο(nlogn) Compare it to . In the worst case Ο(n2) Compare it to , But it's not common . In fact, quicksort is usually significantly better than the others Ο(nlogn) Algorithm faster , Because its internal loop can be implemented efficiently on most architectures .

Count sorting

The core of counting and sorting is to convert the input data values into keys and store them in the extra array space . Sort as a linear time complexity , Counting sort requires that the data entered must be an integer with a defined range .

Radix sorting

Cardinality sorting is a non comparative integer sorting algorithm , The principle is to cut integers into different numbers according to the number of digits , Then compare each digit separately . Because integers can also express strings and floating-point numbers in specific formats , So Radix sorting is not only used for integers .

版权声明
本文为[It education for old boys]所创,转载请带上原文链接,感谢
https://pythonmana.com/2021/02/20210223112842014k.html

  1. 阿里、华为Python工程师总结的实用技巧,只有你还没看?
  2. 酸了!看到抖音上Python程序员晒得工资条......
  3. Python基础之:数字字符串和列表
  4. Importing excel into database adaptively by Python
  5. Python安装教程
  6. Python安装教程
  7. From Xiaobai to master, here is a guide to pandas
  8. [Python] drawing method of stem leaf diagram and compound pie diagram
  9. Drawing of Python geoplot spatial kernel density estimation map
  10. Python Seaborn economist's classic chart imitation
  11. Python space drawing - regionmask mask operation example
  12. Python space drawing - cartopy longitude and latitude add
  13. Python pykrige package Kriging interpolation calculation and visual rendering
  14. Python batch resampling, mask, slope extraction
  15. Python - Analysis of reachable circle of multiple traffic modes
  16. Python space drawing bubble drawing
  17. Python 3 multithreading and Mongo 100 million consumption log data fresh demo
  18. ARIMA model for predicting time series of CO2 concentration
  19. python isinstance()
  20. How to modify tens of thousands of file names with one key in Python
  21. Python notes: List
  22. Translation: practical Python Programming 02_ 03_ Formatting
  23. Python中的四种队列(queue)、堆(heap)
  24. Side effects of Python mutable types as default parameters of functions
  25. This is the best Python tutorial I've ever seen: ten minutes to get to know python
  26. 使用python编写量子线路打印的简单项目,并使用Sphinx自动化生成API文档
  27. Python happy enemy: crawler and anti crawler with a solution to give you New Year
  28. 使用python编写量子线路打印的简单项目,并使用Sphinx自动化生成API文档
  29. When writing python, you will encounter the following error: modulenotfounderror: no module named ' email.mime '; 'email' is not a package
  30. Python class call and private and public property method call
  31. Proprietary methods for Python classes
  32. Foundation of Python: number string and list
  33. Foundation of Python: number string and list
  34. Foundation of Python: number string and list
  35. 华为 Python网络自动化
  36. Python Cannot open E:\Python36\Scripts\pip-script.py
  37. Peeping into the future is not a dream, python data analysis is easy to achieve
  38. The practical skills summed up by Alibaba and Huawei Python engineers, only you haven't seen them yet?
  39. Sour! See the Python programmers on the tiktok get the pay slip...
  40. Foundation of Python: number string and list
  41. Python installation tutorial
  42. Python installation tutorial
  43. This article will familiarize you with the transformation process of Python - > Cafe - > om model
  44. Four kinds of queues and heaps in Python
  45. Using Python to write a simple project of quantum circuit printing, and using Sphinx to automatically generate API documents
  46. Using Python to write a simple project of quantum circuit printing, and using Sphinx to automatically generate API documents
  47. Huawei Python Network Automation
  48. Python Cannot open E:\Python36\Scripts\pip- script.py
  49. 找不到Python问题解决
  50. PHP和Python哪个更有市场前景?我学的是PHP
  51. Python problem resolution not found
  52. Which has more market prospects, PHP or Python? I studied PHP
  53. Foundation of Python: number string and list
  54. python 编码问题之终极解决
  55. The ultimate solution to the problem of Python coding
  56. 能取值亦能赋值的Python切片
  57. Python slice with value and value
  58. 能取值亦能赋值的Python切片
  59. Python slice with value and value
  60. python 异常处理