Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
aa:lab:14 [2021/01/22 09:02] pdmatei |
aa:lab:14 [2021/01/24 15:10] (current) roxana_elena.stiuca fixed number of nodes in complete binary tree |
||
|---|---|---|---|
| Line 8: | Line 8: | ||
| Prove the following properties are true, using structural induction: | Prove the following properties are true, using structural induction: | ||
| - | 1. $math[forall t\in \texttt{Tree}. size(t) \geq height(t)] | + | 1. $math[\forall t\in \texttt{Tree}. size(t) \geq height(t)] |
| + | |||
| + | 2. $math[\forall t \in \texttt{Tree}. flatten(mirror(t)) = reverse(flatten(t))] | ||
| + | |||
| + | Find a proper formulation and prove the following properties: | ||
| + | |||
| + | 1. Merging (using the strategy from ''Mergesort'') two sorted lists produces a sorted list. | ||
| + | |||
| + | 2. A complete binary tree always has $math[2^{height(t)}-1] nodes. | ||