diff --git a/data_structures/QueueOnList.py b/data_structures/QueueOnList.py new file mode 100644 index 000000000..571d5d26a --- /dev/null +++ b/data_structures/QueueOnList.py @@ -0,0 +1,35 @@ +"""Queue represented by a python list""" +class Queue(): + def __init__(self): + self.entries = [] + self.length = 0 + + """Enqueues {@code item} + @param item + item to enqueue""" + def enqueue(self, item): + self.entries.append(item) + self.length = self.length + 1 + print(self.entries) + + """Dequeues {@code item} + @requirement: |self.length| > 0 + @return dequeued + item that was dequeued""" + def dequeue(self): + self.length = self.length - 1 + dequeued = self.entries[0] + self.entries = self.entries[1:] + return dequeued + + """Enqueues {@code item} + @return item at front of self.entries""" + def front(self): + return self.entries[0] + + """Returns the length of this.entries""" + def length(self): + return self.length + + + diff --git a/other/anagrams.txt b/other/anagrams.txt new file mode 100644 index 000000000..e69de29bb