lv - array
Last updated
Was this helpful?
Last updated
Was this helpful?
static array = a fixed capacity that needs to be specified at allocation.
dynamic array = allows elements to be added or removed, without specify length in the beginning.
python list
python dict
indexing
O(1)
get item
O(1)
index assignment
O(n)
iteration
O(n)
pop(i)
O(n)
copy
O(n)
Lists = dynamic arrays of pointers. (indexing = O(1))
RAM (random access memory) = indexing with O(1)
Python Unicode = 2 Bytes
indexing = start + cell_size * index
shallow copy = copy reference
deep copy = copy elements
dynamic array with amortized to append elements: average expanding op is O(1), actually ~O(3)
two sorted string are the same -> anagram.
white space is not considered.
solution = hash table
solution: sets for checking