COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
enQueue(item)
|
|
Append.Queue(item)
|
|
enQueue()
|
|
AddItem(EnQueue())
|
Detailed explanation-1: -In the queue only two operations are allowed enqueue and dequeue. Enqueue means to insert an item into the back of the queue, dequeue means removing the front item.
Detailed explanation-2: -When we insert the first element in a Queue, front and rear both are set to 0. When we insert a new element, the rear gets incremented, i.e., rear=rear+1.
Detailed explanation-3: -enqueue(): Inserts an element at the end of the queue i.e. at the rear end. dequeue(): This operation removes and returns an element that is at the front end of the queue.
Detailed explanation-4: -Insertion and deletion in queues takes place from the opposite ends of the list. The insertion takes place at the rear of the list and the deletion takes place from the front of the list. Insert operation is called push operation. Insert operation is called enqueue operation.