A queue is implemented using a non-circular singly linked list. The queue has a head pointer and a tail pointer: the head points to the first node, each node points to the next one, and the tail points to the last node. 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.Which one of the following is the time complexity of the most time-efficient implementation of enqueue and dequeue, respectively, for this data structure?
- A\(\Theta (1), \Theta (1)\)
- B\(\Theta (1), \Theta (n)\)
- C\(\Theta (n), \Theta (1)\)
- D\(\Theta (n), \Theta (n)\)