0
Heapsort
Heapsort <ul><ul><li>Heapsort is a sorting algorithm that makes use of a binary tree. </li></ul></ul><ul><ul><li>Heapsort ...
What is a heap <ul><li>A balanced, left-justified binary tree in which </li></ul><ul><li>no node has a value greater than ...
What is a heap <ul><li>A balanced, left-justified binary tree in which </li></ul><ul><li>no node has a value greater than ...
What is a heap <ul><li>A balanced, left-justified binary tree in which </li></ul><ul><li>no node has a value greater than ...
What is a heap <ul><li>A balanced, left-justified binary tree in which </li></ul><ul><li>no node has a value greater than ...
Skipping Several pages of Algorithm Description for this class
Insert The following values into a heap <ul><li>8, 10,5, 12 </li></ul>
Insert The following values into a heap <ul><li>8, 10,5, 12 </li></ul>8 Insert 8 at head of tree
Insert The following values into a heap <ul><li>8, 10,5, 12 </li></ul>Insert Ten as child of 8. 8 10
Insert The following values into a heap <ul><li>8, 10,5, 12 </li></ul>Insert Ten as child of 8. Then  Shift Up 8 10 10 8
Insert The following values into a heap <ul><li>8, 10,5, 12 </li></ul>Insert 5 as child of root Tree fits the properties o...
Insert The following values into a heap <ul><li>8, 10,5, 12 </li></ul>Insert 12 a the left most child. 10 8 5 12
Insert The following values into a heap <ul><li>8, 10,5, 12 </li></ul>Shift up until heap the tree becomes a heap. 10 8 5 ...
Upcoming SlideShare
Loading in...5
×

Heapsort

1,593

Published on

heap sort educational powerpoing

Published in: Education, Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,593
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
84
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Heapsort"

  1. 1. Heapsort
  2. 2. Heapsort <ul><ul><li>Heapsort is a sorting algorithm that makes use of a binary tree. </li></ul></ul><ul><ul><li>Heapsort is always O(n log n) </li></ul></ul><ul><ul><ul><li>there are other  algorithms  such as quicksort that perform better in good scenarios but in worst case perform at O(n 2) </li></ul></ul></ul><ul><ul><ul><li>Heapsort is worst case O(n log n) so it is better for critical applications </li></ul></ul></ul>
  3. 3. What is a heap <ul><li>A balanced, left-justified binary tree in which </li></ul><ul><li>no node has a value greater than the value in its </li></ul><ul><li>parent </li></ul>Left-justified Not left-justified 12 8 3 12 8 12 12 8 14
  4. 4. What is a heap <ul><li>A balanced, left-justified binary tree in which </li></ul><ul><li>no node has a value greater than the value in its </li></ul><ul><li>parent </li></ul>Left-justified Not left-justified 12 8 3 12 8 12 12 8 14 Heap
  5. 5. What is a heap <ul><li>A balanced, left-justified binary tree in which </li></ul><ul><li>no node has a value greater than the value in its </li></ul><ul><li>parent </li></ul>Left-justified Not left-justified 12 8 3 12 8 12 12 8 14 Heap Heap
  6. 6. What is a heap <ul><li>A balanced, left-justified binary tree in which </li></ul><ul><li>no node has a value greater than the value in its </li></ul><ul><li>parent </li></ul>Left-justified Not left-justified 12 8 3 12 8 12 12 8 14 Heap Heap Not a Heap
  7. 7. Skipping Several pages of Algorithm Description for this class
  8. 8. Insert The following values into a heap <ul><li>8, 10,5, 12 </li></ul>
  9. 9. Insert The following values into a heap <ul><li>8, 10,5, 12 </li></ul>8 Insert 8 at head of tree
  10. 10. Insert The following values into a heap <ul><li>8, 10,5, 12 </li></ul>Insert Ten as child of 8. 8 10
  11. 11. Insert The following values into a heap <ul><li>8, 10,5, 12 </li></ul>Insert Ten as child of 8. Then Shift Up 8 10 10 8
  12. 12. Insert The following values into a heap <ul><li>8, 10,5, 12 </li></ul>Insert 5 as child of root Tree fits the properties of a heap no addional steps are needs 10 8 5
  13. 13. Insert The following values into a heap <ul><li>8, 10,5, 12 </li></ul>Insert 12 a the left most child. 10 8 5 12
  14. 14. Insert The following values into a heap <ul><li>8, 10,5, 12 </li></ul>Shift up until heap the tree becomes a heap. 10 8 5 12 10 12 5 8 12 10 5 8
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×