A circular queue has been implemented using a singly linked list where each node consist of a value and a single pointer pointing to the next node. We maintain exactly two external pointers FRONT and REAR pointing to the front node and rear node of the queue, respectively. Which of the following statement is/ are CORRECT for such a circular queue, so that insertion and deletion operations can be performed in 0 (1) time?
I. Next pointer of front node point to the rear node.
II. Next pointer of rear node points to the front node.
Since insertion in a queue are always from REAR and deletion is always from FRONT. Hence having the next pointer of REAR node pointing to the FRONT node will lead to both insertion and deletion operations in O(1) time.
A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed efficiently. Which one of the following statements is CORRECT (n refers to the number of items in the queue)?
Let Q denote a queue containing sixteen numbers and S be an empty stack. Head(Q) returns the element at the head of the queue Q without removing it from Q. Similarly Top(S) returns the element at the top of S without removing it from S. Consider the algorithm given below.
The maximum possible number of iterations of the while loop in the algorithm is____________ .
Suppose a stack implementation supports an instruction REVERSE, which reverses the order of elements on the stack, in addition to the PUSH and POP instructions. Which one of the following statements is TRUE with respect to this modified stack?
Consider the following operation along with Enqueue and Dequeue operations on queues, where k is a global parameter. MultiDequeue(Q){ m = k while (Q is not empty) and (m > 0) { Dequeue(Q) m = m – 1 } } What is the worst case time complexity of a sequence of n queue operations on an initially empty queue?
Suppose a circular queue of capacity (n −1) elements is implemented with an array of n elements. Assume that the insertion and deletion operations are carried out using REAR and FRONT as array index variables, respectively. Initially, REAR = FRONT = 0. The conditions to detect queue full and queue empty are