COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
25 300 10 20
|
|
10 20 25 300
|
|
20 10 300 25
|
|
None of the above
|
Detailed explanation-1: -In a queue, one end is always used to insert data (enqueue) and the other is used to delete data (dequeue), because queue is open at both its ends. The enqueue() and dequeue() are two important functions used in a queue.
Detailed explanation-2: -In queue, insertion operation is known as Enqueue whereas deletion operation is known as Dequeue. Insertion and deletion operation in queue is known as enqueue and dequeue.
Detailed explanation-3: -(2) Algorithm for Deleting a node from a Linear Queue : Step 1 : If FRONT = NULL : then Write ‘Queue is Empty(Queue Underflow)’ and return. [End of If structure] Step 2 : Set PTR = FRONT Step 3 : Set NUM = PTR->INFO Step 4 : Write ‘Deleted element from linear queue is : ‘, NUM.
Detailed explanation-4: -The insertion of an element in a queue is called an enqueue operation and the deletion of an element is called a dequeue operation.