Пример #1
0
class Stack:
    def __init__(self):
        self.list = LinkedListSingle()

    def push(self, data):
        self.list.addnode(data)
        return data

    def peek(self):
        return self.list.peek().getdata()

    def pop(self):
        return self.list.pop().getdata()

    def isEmpty(self):
        return self.list.isEmpty()
Пример #2
0
 def __init__(self):
     self.list = LinkedListSingle()