Cs 301
Cs 301
equal to 2d+1 – 1.
In a complete binary tree there are 2d leaf nodes and 2d – 1 non-leaf nodes.
𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑛𝑜𝑑𝑒𝑠, 𝑛 = 2𝑑+1 − 1
2𝑑+1 − 1 = 𝑛
𝑑 = log 2 (𝑛 + 1) − 1
In a given binary tree of depth d, the maximum number of executions of the while loop will be
equal to d.
Convert infix to postfix using stack Lecture 07
Convert expression tree to infix using in-order recursive Lecture 25
traversal
Convert postfix to expression tree using stack Lecture 25