79465995

Date: 2025-02-25 09:28:29
Score: 2
Natty:
Report link

If you just want to know if an element is present or not in a heap, just use hashset in conjunction to the heap. If you want the index of the element also, use a hashmap with the heap elements as keys and their indices as values. You will require an extra auxiliary space of O(1). But it can reduce the time complexity of search to same as hashmap's complexity

Reasons:
  • No code block (0.5):
  • Single line (0.5):
  • Low reputation (1):
Posted by: T Bala Sundar