📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!

  • google app store apple app store
  • ✖

      Question

      Which data structure is most suitable for implementing a

      priority queue with logarithmic time complexity for insertion and deletion?
      A Stack Correct Answer Incorrect Answer
      B Queue Correct Answer Incorrect Answer
      C Binary Heap Correct Answer Incorrect Answer
      D AVL Tree Correct Answer Incorrect Answer
      E Hash Table Correct Answer Incorrect Answer

      Solution

      A binary heap offers O(log n) insertion and deletion operations, ideal for priority queues. Other options: Stack/Queue don’t maintain priority; AVL Tree offers O(log n) but more overhead; Hash Table doesn’t maintain order.

      Practice Next
      ask-question