Just a little speed test of a double sided queue (ie you can add and pop on both sides it can be tought as the merge of 2 stacks or 2 queues) Implementation : a looping list where adding and removing just extend the queue inside a bigger and fixed scratch list Operations : You can add and pop on both sides with a time (and space) complexity of O(1) (not even a branch so rly fast) and get the size of the queue in O(1) (there is a branch so a bit slower) Watch out if you want to use it : this is absolutely not fool proof (eg you can pop items that dont exist) Credits: All by me (@morveman my main) [well... dont mind this] #math #computer #science #O #queue #fast #implementation #double #why #are #you