Lists
Multi-Dimensional Lists
Arrays
Dictionaries
Sets
Tuples
Linked-Lists
Queues
Stacks
Used in Djikstra's Shortest Path and Prim's Minimum Spanning Tree
myList = []
import array as arr
myArr = arr.array('i', [1, 2 , 3])
myDict = {} --> Empty dict NOT empty set
mySet = {'a','b','c'} OR mySet = set(['a','b','c'])
myTuple = (a,b)
LL = LinkedList()
LL.head = Node(3)
from queue import Queue
q = Queue(mazesize = n)
from queue import LifoQueue
stack = LifoQueue(mazesize=3)
import heapq
myList = [1, 2, 3]
heapq.heapify(myList)
.copy(x) --> returns a shallow copy of x
.deepcopy(x) --> returns a deep copy of x
Lists: Yes
Dictionaries: Yes
Tuples: No
Sets: Yes
Frozen Set: No --> frozen() to change to change set to frozen set
Byte Array: Yes
Lists: Yes
Tuples: Yes
Sets: No
Lists: Yes
Tuples: Yes
Sets: No
Lists: Yes
Tuples: Yes
Sets: No
O(1) --> Amazing
O(logN) --> Great
O(N) --> Good
O(N+k) --> Good
O(N logN) --> Bad
O((N logN)^2) --> Really Bad
O(2^n) --> Horrible
O(n!) --> Atrocious
Lists: O(1)
Dicts: O(1)
Sets: O(1)
Lists: O(1)
Dictionaries: O(1)
Sets: O(1)
Lists: O(N)
Dictionaries: O(1)
Sets: O(1)
Lists: O(N)
Dictionaries: O(N)
Sets: O(N)
Lists: O(N logN)
Breadths First Search, Depth First Search, Djikstra's Shortest, Dynamic Programming, Recursion