stack and queue implementations using heaps