Question: What would happen if we used List.PushFront to implement Enqueue and List.TopBack and List.PopBack to implement Dequeue? The queue would work correctly. The queue wouldn't
What would happen if we used List.PushFront to implement Enqueue and List.TopBack and List.PopBack to implement Dequeue?
The queue would work correctly.
The queue wouldn't work right
The queue would work correctly if the list were singly-linked with a tail pointer.
The queue would work correctly if the list were doubly-linked with a tail pointer.
The queue would work correctly, but Dequeue would be O(n) time if the list were singly-linked with a tail pointer.
The queue would work correctly, but Dequeue would be O(n) time if the list were doubly-linked with a tail pointer.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
