def __init__(self, limit=10): self.limit = limit self.storage = DoublyLinkedList()
def __init__(self): self.size = 0 # Why is our DLL a good choice to store our elements? # self.storage = ? self.storage = DoublyLinkedList()
def __init__(self, limit=10): self.limit = limit self.size = 0 self.cache = DoublyLinkedList() self.storage = {}
def __init__(self, limit=10): self.storage = DoublyLinkedList() self.capacity = 0 self.limit = limit self.kv_dict = {}
def __init__(self, capacity): self.capacity = capacity self.current = None self.storage = DoublyLinkedList()
def __init__(self): self.size = 0 # Why is our DLL a good choice to store our elements? # Because it has all of the methods we need to create and manipulate a stack, without having to rewrite code self.storage = DoublyLinkedList(None)
def __init__(self, limit=10): self.limit = limit self.size = 0 self.storage = {} self.order = DoublyLinkedList()
def __init__(self): self.size = 0 # Why is our DLL a good choice to store our elements? # > Because this structure is made to resize one element at a time on one end self.storage = DoublyLinkedList()
def __init__(self): self.size = 0 # Why is our DLL a good choice to store our elements? because stack is easily implemented on a linked list self.storage = DoublyLinkedList()
def __init__(self): self.size = 0 # Why is our DLL a good choice to store our elements? # DLL Is a good choice for a stack because of the time complexity associated with adding # and removing from a DLL is O(1). self.storage = DoublyLinkedList()
def __init__(self): #keeps track of the size of the queue #but is redundant below should delete self.size = 0 # Why is our DLL a good choice to store our elements? self.storage = DoublyLinkedList()
f = open( 'C:/Users/nchib/DS5/Sprint-Challenge--Data-Structures-Python/names/names_1.txt', 'r') names_1 = f.read().split("\n") # List containing 10000 names f.close() f = open( 'C:/Users/nchib/DS5/Sprint-Challenge--Data-Structures-Python/names/names_2.txt', 'r') names_2 = f.read().split("\n") # List containing 10000 names f.close() names_f = names_1 + names_2 names_f.sort() dll = DoublyLinkedList() for name_f in names_f: dll.add_to_tail(name_f) def findDuplicates(self, head): duplicates = [] # Return the list of duplicates in this data structure p1 = head p2 = head.next while p2 is not None: # increment both pointers UNTIL they are while p2 is not None and p1.value != p2.value: p1 = p1.next p2 = p2.next while p2 is not None and p1.value == p2.value: duplicates.append(p1.value)
def __init__(self): """Initiate the stack with size 0 and the DoublyLinkedList as storage """ self.size = 0 self.storage = DoublyLinkedList()
def __init__(self): self.data_list = DoublyLinkedList()
def __init__(self, limit=10): self.limit = limit self.storage = DoublyLinkedList() #self.current = len(self.storage) self.storage_dict = {} self.size = 0
def __init__(self): self.size = 0 # what data structure should we # use to store queue elements? self.storage = DoublyLinkedList()
def __init__(self, init=None): self.contents = DoublyLinkedList() # check if an init string is provided # if so, put the contents of the init string in self.contents if init: self.append(init)
def __init__(self): self.size = 0 # Why is our DLL a good choice to store our elements? # it has the needed essentials of a list that has a beggining and end self.storage = DoublyLinkedList()
def __init__(self, init=None): self.contents = DoublyLinkedList() if init: for char in init: self.contents.add_to_tail(char)
def __init__(self, limit=10): self.size = 0 self.limit = limit self.dll = DoublyLinkedList() self.storage = dict() # same as {}
def __init__(self, init=None): self.storage = DoublyLinkedList() if init: self.append(init)
def __init__(self): self.size = 0 # Why is our DLL a good choice to store our elements? more efficient with an O(1) runtime self.storage = DoublyLinkedList()
def __init__(self, limit=10): self.limit = limit self.cache = DoublyLinkedList() self.dict = {}
def __init__(self): self.size = 0 self.list = DoublyLinkedList()
def __init__(self): self.size = 0 self.storage = DoublyLinkedList()
def __init__(self, limit=10): pass self.limit = limit self.storage = DoublyLinkedList() self.storage_dict = {}
def setUp(self): self.node = ListNode(1) self.dll = DoublyLinkedList(self.node)
def __init__(self, limit=10): self.limit = limit self.list = DoublyLinkedList() self.table = {}
# - forwards # - backwards def find_middle(dll): head = dll.head tail = dll.tail while head != tail and head.next != tail: head = head.next tail = tail.prev return head.value odd_nums = DoublyLinkedList() [odd_nums.add_to_head(i) for i in [5, 3, 4, 10, 7]] print(find_middle(odd_nums)) even_nums = DoublyLinkedList() [even_nums.add_to_tail(i) for i in [ 5, 3, 4, '10', 7, 8, ]] print(find_middle(even_nums)) ians_nums = DoublyLinkedList()
def __init__(self, capacity): self.capacity = capacity self.storage = DoublyLinkedList() self.oldest = None