Exemple #1
0
class ListStack:
    def __init__(self):
        self._data = LinkedList()

    def push(self, value):
        self._data.insertAtHead(value)

    def pop(self):
        return self._data.pop_head()

    def is_empty(self):
        return (self._data.size() == 0)

    def peek(self):
        return self._data._head.get_value()
Exemple #2
0
class ListStack:

    def __init__(self):
        self._data = LinkedList()

    def push(self, value):
        self._data.insertAtHead(value)
        
    def pop(self):
        return self._data.pop_head()

    def is_empty(self):
        return (self._data.size() == 0)

    def peek(self):
    	return self._data._head.get_value()
Exemple #3
0
class ListQueue:
    def __init__(self):
        self._data = LinkedList()

    def enqueue(self, value):
        self._data.insertAtTail(value)

    def dequeue(self):
        return self._data.pop_head()

    def is_empty(self):
        return (self._data.size() == 0)

    def size(self):
        self._data.size()
Exemple #4
0
class ListQueue:

    def __init__(self):
        self._data = LinkedList()

    def enqueue(self, value):
        self._data.insertAtTail(value)

    def dequeue(self):
        return self._data.pop_head()

    def is_empty(self):
        return (self._data.size() == 0)

    def size(self):
        self._data.size()
Exemple #5
0
 def __init__(self):
     self._data = LinkedList()
Exemple #6
0
 def __init__(self):
     self._data = LinkedList()