What is the time complexity of inserting an element into a binary heap-based priority queue in the worst-case scenario?
O(n log n)
O(1)
O(n)
O(log n)
In a circular queue implemented using an array of size 5, if the front is at index 3 and the rear is at index 1, how many elements are present in the queue?
1
4
2
3
How does a queue ensure that elements are processed in the order they were added?
By using a hash function to index elements.
By dynamically allocating memory for each element.
By using a Last-In, First-Out (LIFO) approach.
By using a First-In, First-Out (FIFO) approach.
You have a queue implemented using a linked list. What is the time complexity of finding the kth element from the front of the queue?
O(k)
O(log k)
In a scenario simulating a print queue, where print jobs with higher priority should be executed first, which queue implementation is most suitable?
Simple queue
Deque (Double-ended queue)
Priority queue
Circular queue
Which data structure is commonly used to implement a priority queue where efficient insertion and removal of the highest-priority element are crucial?
Doubly Linked List
Binary Heap
Binary Search Tree
Hash Table
In a priority queue implementation using a sorted array, what is the time complexity of the dequeue operation in the worst-case scenario?
Which real-world scenario is best represented using a priority queue?
Storing a history of visited web pages in a browser
Managing a print queue where documents are printed in the order they are received
Scheduling tasks in an operating system based on their priority levels
Maintaining a list of recently used applications
How does a circular queue determine if it is full?
Rear pointer reaches the end of the array
A separate variable keeps track of the number of elements
Front pointer equals rear pointer
Front pointer is one position behind the rear pointer (considering wrapping)
When implementing a circular queue, what happens when you try to enqueue an element into a full queue?
The queue dynamically resizes to accommodate the new element
The oldest element is overwritten to make space
The enqueue operation is blocked until space becomes available
An error is thrown, preventing the operation