Thuật toán sắp xếp chèn
Ý tưởng:
Code Python minh họa
a=[]
x=0
while x!=-99:
x=int(input('x= '))
if x!=-99:
j=0
tim=False
while j<len(a) and not(tim):
if x>a[j]:
j+=1
else:
tim=True
a.insert(j,x)
print(a)
https://tritue.edu.vn/tuecode/tracnghiem30/site/data/YVdRc01qRXhMRjl5YjNWMFpTeGlZV2wyYVdWMEwzQnZjM1F2ZG1sbGR3PT0%3D