20 likes | 261 Vues
Sorted List 1. Sorted List 2. 1. 3. 4. 5. 8. 11. 9. 34. Merge 2 Sorted lists. Final List. 1. 3. 4. 5. 8. 9. 11. 34. 15. 15. 2. 2. 4. 4. 5. 5. 9. 9. 12. 12. 15. 15. 19. 23. 25. 28. 31. 37. 40. 50. 52. 16. Insertion Sort. E.g. Allocate an extra
E N D
Sorted List 1 Sorted List 2 1 3 4 5 8 11 9 34 Merge 2 Sorted lists Final List 1 3 4 5 8 9 11 34
15 15 2 2 4 4 5 5 9 9 12 12 15 15 19 23 25 28 31 37 40 50 52 16 Insertion Sort E.g. Allocate an extra memory location Copy the data one by one Searching the position first 15 19 19 23 25 28 31 37 40 50 52 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15