cleaning up and organizing old problems (builtin)

This commit is contained in:
Mari Wahl 2015-01-06 20:10:48 -05:00
parent 6afe96fa4d
commit 3fdbc2a605
106 changed files with 480 additions and 1472 deletions
src/abstract_structures

View file

@ -0,0 +1,27 @@
#!/usr/bin/env python
__author__ = "bt3"
class Queue(object):
def __init__(self):
self.enq = []
self.deq = []
def enqueue(self, value):
self.enq.append(value)
def dequeue(self):
if not self.deq:
while self.enq:
self.deq.append(self.enq.pop())
return self.deq.pop()
if __name__ == '__main__':
q = Queue()
for i in range(1,10):
q.enqueue(i)
for i in range(1, 10):
print q.dequeue()