七大排序算法汇总(python实现)
关注“python趣味爱好者”公众号,回复“排序算法”获取源代码 目前,常见的排序算法有: 冒泡排序 插入排序 选择排序 堆排序 计数排序 快速排序 本篇文章将围绕这七大算法进行介绍,我们先来学习一下整体的代码结构: class SORT ( object ) : def __init__ ( self ) : self . arr = [ 20 , 64 , 34 , 25 , 12 , 22 , 11 , 90 ] self . n = len ( self . arr ) self . num = 0 print ( self . arr ) def out_put ( self ) : print ( 50 * '-' ) print ( "最终排序结果" , self . arr ) def bubbleSort ( self ) : #冒泡排序 pass def shellSort ( self ) : #希尔排序 pass def insertionSort ( self ) : #插入排序 pass def Selectionsort ( self ) : #选择排序 pass def heapSort ( self ) : #堆排序 pass def countSort ( self ) : #计数排序 pass def quickSort ( self ) :