Double ended queue and randomized queue