C-Programming-data-structure || 2018 MCQ || 1-mark || Module 2: Arrays | Stacks | Queue | Linked list

Last Updated :
Discuss
Comments

A queue is implemented using a non-circular singly linked list. The queue has a head pointer and a tail pointer, as shown in the figure. Let n denote the number of nodes in the queue. Let 'enqueue' be implemented by inserting a new node at the head, and 'dequeue' be implemented by deletion of a node from the tail.

Screenshot-2025-05-20-124839

Which one of the following is the time complexity of the most time-efficient implementation of 'enqueue' and 'dequeue, respectively, for this data structure? 2018 MCQ || 1-mark

θ(1), θ(1)

 θ(1), θ(n)

 θ(n), θ(1)

θ(n), θ(n)


Share your thoughts in the comments
Article Tags :