Posted By

maturanti19 on 05/22/19


Tagged

sort python array triedenie poli


Versions (?)

Triedenie poli sorting of arrays


 / Published in: Python
 

Utriedte pole Sort Array

  1. p1=[1, 10, 100 , 101, 110, 111]
  2. p2=[2, 20, 200, 202, 220, 222]
  3. p3=[]
  4.  
  5. while len(p1) != 0:
  6. if p1[0] <= p2[0]:
  7. p3.append(p1[0])
  8. del p1[0]
  9. else:
  10. p3.append(p2[0])
  11. del p2[0]
  12. if len(p1)==0:
  13. p3=p3+p2
  14. print(p3)

Report this snippet  

You need to login to post a comment.