Question: A deque is a data structure consisting of a list of items on which the following operations are possible: (a) push ( x,d ): Insert
A deque is a data structure consisting of a list of items on which the following operations are possible: (a) push ( x,d ): Insert item x on the front end of the deque d . (b) pop ( d ): Remove the front item from deque d and return it. (c) inject ( x,d ): Insert item x on t he rear end of deque d . (d) eject ( d ): Remove the rear item from deque d and return it. Choose a proper representation and write functions that take O (1) time to support each of the above operations. - Please answer in C++
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
