alalbux / js-studies

0 stars 0 forks source link

Queue #4

Open alalbux opened 5 years ago

alalbux commented 5 years ago

class Queue(object):
    def __init__(self, head=None):
        self.storage = [head]

    def enqueue(self, new_element):
        self.storage.append(new_element)

    def peek(self):
        return self.storage[0]

    def dequeue(self):
        return self.storage.pop(0)