Created
March 6, 2019 02:53
-
-
Save DustinAlandzes/214bd5b7ff68b98ef85f2075e482b6dd to your computer and use it in GitHub Desktop.
a Queue class using Python lists: http://interactivepython.org/runestone/static/pythonds/BasicDS/ImplementingaQueueinPython.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Queue: | |
def __init__(self): | |
self.items = [] | |
def isEmpty(self): | |
return self.items == [] | |
def enqueue(self, item): | |
self.items.insert(0,item) | |
def dequeue(self): | |
return self.items.pop() | |
def size(self): | |
return len(self.items) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment