NumPy Array
””””
More than one dimension:
np.array([[1, 2], [3, 4]])
array([[1, 2],
[3, 4]])
“”””
Minimum dimensions 2:
np.array([1, 2, 3], ndmin=2)
array([[1, 2, 3]])
“”””
Type provided:
np.array([1, 2, 3], dtype=complex)
array([ 1.+0.j, 2.+0.j, 3.+0.j])
zip function
Iterables
Tuples
Binary tree
Each node has at MOST 2 children
Binary search tree
a binary tree in which all the left children of a node <= n (node in question) < all right descendants
Static memory allocation
E.g., stacks or arrays: will manage memory for you and assume a fixed amount of memory upon instantiation with a cap on how much data may be added.
dynamic memory allocation
e.g., heaps or linked lists: allow you to allocate and reallocate memory within the life of the program.
Nodes
An individual node contains data and links to other nodes. Each data structure adds additional constraints or behavior to these features to create the desired structure.
Pointers
The link or links within the node are sometimes referred to as pointers. This is because they “point” to another node
What is the time complexity of a linear search algorithm?
O(N)
N/2 depicted as O(N) in Big O connotation
What is the time complexity for binary search?
O(log N)
How many search comparisons will a binary algorithm make in a sorted 1000-element list?
log(1000)
list of integers 1 to n, with one missing, find it
use n*(n+1)/2 formula to find sum of full list, then subtract sum of missing list
Display the first five rows of the DataFrame, including column titles
Df.head()
further commands:
Df.columns
Df.info()
Df.describe()
for a Dataframe df, create a rolling window for the “return” column
df[‘return’].rolling(window=…)
What does .apply(lambda x: (x + 1).prod() - 1) accomplish in the context of rolling windows?
iterate over dict_x
for key, value in dict_x.items():
What are the three main operations for a stack?
hash function will first compute…
a value using some scoring metric –> this is the hash value, hash code, or just the hash.
Our hash map implementation then takes that hash value …. the size of the array (missing word…)
mod
mod = modulo operation
a modulo n (abbreviated as a mod n) is the remainder of the Euclidean division of a by n, where a is the dividend and n is the divisor.
defining feature of all hash functions: they greatly reduce any possible inputs into a much smaller range of potential outputs –> thus known as…
compression functions.
Is hashing a reversible process?
No