Implemented Ternary Heap