fixed the memory allocation to allocate the correct amount of memory, and so we can have a fully balanced tree
renamed getdepth to clog2 (ceil(log2)) to emphasise it's actual calculation and generalise it from the heap functions