Complete Binary Trees Flashcards
complete binary tree
all levels are completely filled in except for the last level which is filled from left to right
complete binary tree in array form. how do you find the parent node?
integer result of the array index / 2. if node is position 2, parent node is 1. if node is position 3, parent node is 1.
complete binary tree in array form. left child node?
array index * 2
complete binary tree in array form. right child node?
array index * 2 plus 1.
complete binary tree in array form. how do you find leaf nodes?
if n is size of array, any index > n / 2 (integer result) is a leaf node
complete binary tree in array form. what’s at the 0th index of the array?
empty (or number of nodes)