Code written for double ended queues