How to convert a list to queue? So that operations like enqueue or dequeue an be carried out. I want to use to the list to remove the top most values and i believe it can be done using queues.
pop from the front of a list is not very efficient as all the references in the list need to be updated.
deque will allow you do queue like operations efficiently
>>> from collections import deque >>> deque([1,2,3,4]) deque([1, 2, 3, 4])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With