Download
insertion n.
Skip this Video
Loading SlideShow in 5 Seconds..
Insertion PowerPoint Presentation

Insertion

102 Vues Download Presentation
Télécharger la présentation

Insertion

- - - - - - - - - - - - - - - - - - - - - - - - - - - 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