use heap to implement stack and queue