adding the push and pop animations

This commit is contained in:
Jidong Xiao
2023-11-13 22:15:13 -05:00
parent a42bfb0488
commit 1209effc0f

View File

@@ -30,6 +30,8 @@ percolate_down(TreeNode<T> * p) {
} }
``` ```
- Play this [animation](https://jidongxiao.github.io/CSCI1200-DataStructures/animations/heap/pop/index.html) to see how the pop works
## 23.2 Implementing Push (a.k.a. Insert) ## 23.2 Implementing Push (a.k.a. Insert)
- To add a value to the heap, a new last leaf node in the tree is created to store that value. - To add a value to the heap, a new last leaf node in the tree is created to store that value.
@@ -47,6 +49,8 @@ percolate_up(TreeNode<T> * p) {
} }
``` ```
- Play this [animation](https://jidongxiao.github.io/CSCI1200-DataStructures/animations/heap/push/index.html) to see how the push works
## 23.3 Push (Insert) and Pop (Delete-Min) Usage Exercise ## 23.3 Push (Insert) and Pop (Delete-Min) Usage Exercise
- Suppose the following operations are applied to an initially empty binary heap of integers. Show the resulting heap after each delete_min operation. (Remember, the tree must be complete!) - Suppose the following operations are applied to an initially empty binary heap of integers. Show the resulting heap after each delete_min operation. (Remember, the tree must be complete!)