Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
aa:lab:08 [2020/11/20 22:26] calin_andrei.bucur |
aa:lab:08 [2020/11/20 22:31] (current) calin_andrei.bucur |
||
---|---|---|---|
Line 101: | Line 101: | ||
7 0 4 | 7 0 4 | ||
- | We start from the last level, which in this case is **ceil(log(10)) = 4** | + | We start from the last level, which in this case is $math[ceil(log(10)) = 4] |
- | from **j = 2^(4-1)** (which is 8) to n-1. On the last level, each tree is a heap. | + | from $math[j = 2^{(4-1)}] (which is 8) to n-1. On the last level, each tree is a heap. |
We now move to a previous level. Say the level is i: | We now move to a previous level. Say the level is i: | ||
- | from **j = 2^(i-1)** to **2^i-1**: | + | from $math[j = 2^{(i-1)}] to $math[2^i-1]: |
we send-down each value on this level, just like in the deletion algorithm, by keeping as the current root, | we send-down each value on this level, just like in the deletion algorithm, by keeping as the current root, |