1 / 7

Insertion

Insertion. size = 26. 2. 26. 10. 18. 21. 29. 27. 57. 20. 47. 37. 69. 69. 29. 58. The heap to start with. 86. 90. 31. 94. 55. 98. 71. 95. 85. 79. 91. Insertion. size = 27. 2. Increment the size. 26. 10. 18. 21. 29. 27. 57. 20. 47. 37. 69. 69. 29. 58.

tala
Télécharger la présentation

Insertion

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Insertion size = 26 2 26 10 18 21 29 27 57 20 47 37 69 69 29 58 The heap to start with... 86 90 31 94 55 98 71 95 85 79 91

  2. Insertion size = 27 2 Increment the size 26 10 18 21 29 27 57 20 47 37 69 69 29 58 25 86 90 31 94 55 98 71 95 85 79 91 Insert 25

  3. Insertion size = 27 2 26 10 18 21 29 27 57 20 47 37 69 69 29 58 while(A[i] < A[i/2]) { swap(A[i],A[i/2]); i = i/2; } 25 86 90 31 94 55 98 71 95 85 79 91 Insert 25

  4. Insertion size = 27 2 26 10 18 21 29 27 57 20 47 37 69 25 29 58 while(A[i] < A[i/2]) { swap(A[i],A[i/2]); i = i/2; } 69 86 90 31 94 55 98 71 95 85 79 91 Insert 25

  5. Insertion size = 27 2 26 10 18 21 25 27 57 20 47 37 69 29 29 58 while(A[i] < A[i/2]) { swap(A[i],A[i/2]); i = i/2; } 69 86 90 31 94 55 98 71 95 85 79 91 Insert 25

  6. Insertion size = 27 2 25 10 18 21 26 27 57 20 47 37 69 29 29 58 while(A[i] < A[i/2]) { swap(A[i],A[i/2]); i = i/2; } 69 86 90 31 94 55 98 71 95 85 79 91 Insert 25

  7. Insertion size = 27 2 25 10 18 21 26 27 57 20 47 37 69 29 29 58 69 86 90 31 94 55 98 71 95 85 79 91

More Related