Data Structure 7 Flashcards
singly-linked list
a data structure for implementing a list ADT, where each node has data and a pointer to the next node
doubly-linked list
a data structure for implementing a list ADT, where each node has data, a pointer to the next node, and a pointer to the previous node. The list structure typically points to the first node and the last node
hash table
a data structure that stores unordered items by mapping (or hashing) each item to a location in an array (or vector)
binary tree
each node has up to two children, known as a left child and a right child.
all(list)
True if every element in list is True (!= 0), or if the list is empty.
any(list)
True if any element in the list is True.
max(list)
Get the maximum element in the list.
min(list)
Get the minimum element in the list.
sum(list)
Get the sum of all elements in the list.
list nesting
a list inside another list
Ex: my_list = [[5, 13], [50, 75, 100]]
my_list[start:end]
Get a list from start to end (minus 1).
Code:my_list = [5, 10, 20]print(my_list[0:2])
Output: [5, 10]
my_list[start:end:stride]
Get a list of every stride element from start to end (minus 1).
Code: my_list = [5, 10, 20, 40, 80]print(my_list[0:5:3])
Output: [5, 40]
my_list[start:]
my_list[start:]
my_list[:end]
Get a list from beginning of list to end (minus 1).
Code: my_list = [5, 10, 20, 40, 80]print(my_list[:4])
Output: [5, 10, 20, 40]
my_list[:]
Get a copy of the list.