Comparing the well-known sorting algorithm
ไหนๆ เรียนวิชา Algorithm มาแล้ว มาเขียน Blog ให้เป็นประโยชน์กะรุ่นน้องหน่อยละกัน Bubble Sort [O(n²)] 1 2 3 4 5 6 7 8 9 def bubble(list): swap = True while swap: swap = False for i in range(len(list)-1): if list[i] > list[i+1] : list[i],list[i+1] = list[i+1],list[i] swap = True return list รา ...
Read More