adding heaps implementation