Example #1
0
class Queue2(object):
    def __init__(self):
        self.L=LinkedList()

    def Enqueue(self,key):
        self.L.PushBack(key)

    def Dequeue(self):
         return self.L.PopFront()

    def isEmpty(self):
        return self.L.isEmpty()
Example #2
0
class Stack2(object):
    def __init__(self):
        self.L = LinkedList()

    def Push(self, key):
        self.L.PushFront(key)

    def Top(self):
        return self.L.TopFront()

    def Pop(self):
        self.L.PopFront()

    def isEmpty(self):
        return self.L.isEmpty()