Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Like this presentation? Why not share!

3,834 views

Published on

heap sort educational powerpoing

No Downloads

Total views

3,834

On SlideShare

0

From Embeds

0

Number of Embeds

24

Shares

0

Downloads

199

Comments

0

Likes

3

No embeds

No notes for slide

- 1. Heapsort
- 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. 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. 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. 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. 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. Skipping Several pages of Algorithm Description for this class
- 8. Insert The following values into a heap <ul><li>8, 10,5, 12 </li></ul>
- 9. Insert The following values into a heap <ul><li>8, 10,5, 12 </li></ul>8 Insert 8 at head of tree
- 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. 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. 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. 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. 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

No public clipboards found for this slide

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment