adding the push and pop animations
This commit is contained in:
@@ -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!)
|
||||||
|
|||||||
Reference in New Issue
Block a user