Beispiel #1
0
 def __init__(self, the_type):
     if the_type == "array":
         ArrayDeque.__init__(self)
     elif the_type == "linked":
         LinkedList.__init__(self)
Beispiel #2
0
from my_array_deque import ArrayDeque
from my_linked_list import LinkedList
from my_stack import Stack
from my_queue import Queue

print("\nTESTING ARRAY_DEQUE\n")

deque = ArrayDeque()
deque.push_back(3)
deque.push_back(1)
deque.push_back(6)
deque.push_back(9)
print("container of size: " + str(deque.get_size()) + ":")
print(deque)
print(deque.pop_back())
print(deque.pop_back())
print("container of size: " + str(deque.get_size()) + ":")
print(deque)
deque.push_front(11)
deque.push_front(16)
deque.push_front(13)
print("container of size: " + str(deque.get_size()) + ":")
print(deque)
print(deque.pop_front())
print(deque.pop_front())
print(deque.pop_front())
print("container of size: " + str(deque.get_size()) + ":")
print(deque)
print(deque.pop_front())
print(deque.pop_back())
print(deque.pop_front())
Beispiel #3
0
 def __init__(self, datastructure="array"):
     if datastructure == "array":
         self.datastructure = ArrayDeque()
     else:
         self.datastructure = LinkedList()
Beispiel #4
0
 def __init__(self, type: str):
     if type == "array":
         self.my_queue = ArrayDeque()
     elif type == "linked":
         self.my_queue = LinkedList()
Beispiel #5
0
 def __init__(self, type="array"):
     if type == "array":
         self.__array = ArrayDeque()
     else:
         self.__array = LinkedList()
 def get_type(self, type_input_str):
     '''Returns the type of given string input'''
     if type_input_str == 'array':
         return ArrayDeque()
     elif type_input_str == 'linked':
         return LinkedList()
Beispiel #7
0
 def __init__(self, type: str):
     if type == 'array':
         self.container = ArrayDeque()
     else:
         self.container = LinkedList()
Beispiel #8
0
 def __init__(self, _type_):
     self.type = _type_
     if self.type == 'array':
         self.queue = ArrayDeque()
     elif self.type == 'linked':
         self.queue = LinkedList()
Beispiel #9
0
    def __init__(self, a_type):

        if a_type == 'array':
            self.instance = ArrayDeque()
        else:
            self.instance = LinkedList()