Exemplo n.º 1
0
class Queue:
    def __init__(self):
        self.queue = DoublyLinkedList()

    def add(self, data):
        self.queue.add_node(data)

    @property
    def remove(self):
        self.queue.remove_node(1)

    @property
    def empty(self):
        self.queue.lenght = 0

    @property
    def peek(self):
        self.queue.show()
Exemplo n.º 2
0
class Stack:
    def __init__(self):
        self.stack = DoublyLinkedList()

    def push(self, data):
        self.stack.add_node(data)

    @property
    def pop(self):
        self.stack.remove_node()

    @property
    def empty(self):
        self.stack.lenght = 0

    @property
    def peek(self):
        return self.stack.show(reverse=True)