Please enable JavaScript.
Coggle requires JavaScript to display documents.
fb screening - Coggle Diagram
fb screening
screening
algorithms
depth-first search
-
-
-
-
O(V + E), V = vertices, E = edges
O(V^2) if adjacency matrix is used
-
breadth-first search
-
-
O(V + E), V = vertices, E = edges
O(V^2) if adjacency matrix is used
-
-
-
divide-and-conquer:
sub-problems, not overlapping
sorting
-
quick sort O(n * log(n))
divide-and-conc
- pick pivot point
- ensure elements to the left are less than pivot
- ensure elements to the right are bigger than pivot
- apply algorithm to both parts recursively
selection sort O(n^2)
- divide to two parts: sorted and unsorted
- find least one in unsorted, move to sorted, etc.
insertion sort O(n^2)
- start -> end, pick an element
- find a place in the left (sorted) part of an array:
- find the index of the last element that is less and insert the current element after it (or swap 1-by-1)
heap sort O(n * log n)
- like selection: sorted and unsorted regions
- unsorted region = heap
- root of the heap = max elem, swap last elem and root, rebuild the heap, repeat
-
kadane's alg:
subarray with maximum sum in array
if curr el + sum of prev elems < curr el, curr sum = curr el
check curr sum against max sum
data structures
-
graph
disjoint set
-
for vertexes V and edges E
store array of 'parents' and 'ranks': array index of parent element of the current element. Eventual top-level parent is a representative of a set.
representative may be initially picked by biggest node value or index. E.g. for edge [1,2] it's 2
union-find
find = traverse through the parents to the top one + store a link to the top paren in the entry of interest
union = find parents of each of the two nodes and set the same parent by rank.
applications:
- search for a loop in an undirected graph
heap
- tree-based
- P = parent, C = node
- min heap: P key <= C key
- max heap: P key >= C key
-
-
- array, each elem = node
- parent / child defined by index
- node index i => children are (2i + 1) and (2i + 2); parent at floor((i - 1) / 2)
needs to be re-balanced (sift-up, sift-down)
-
tree (+binary)
b-tree = generalization of binary search tree:
- search, access, insert, delete = O(log N)
- self-balanced
binary search tree:
- node's value greater than values in the left subtree
- node's value is less than values in the right subtree
-
-
linked list
- slow-fast pointers
- dummy node
-
-
-
big O
space
-
memory usage (number of elements in arrays, etc)
time
divide steps by K: O(logN), k is log base
-
-
pick dominant:
- O(N + logN) = O(N)
- O(N + N/2) = O(N)
-
-
- check CoderPad.io
- ask how many questions will be asked (1 or 2)
general stuff
прогрессии:
- арифм: an = a1 + d ( n – 1 )
Sn = (a1 + an) n / 2 = 2 a1 + d (n - 1) n / 2
- геом: bn = b1 * q ^ (n - 1)
Sn = b1 * (1 - q ^ n) / (1 - q)
if (q < 1): S = b1 / (1 - q)
-
-
dynamic programming
= divide and conquer with overlapping subproblems
- overlapping subproblems
- optimal solution can be constructed from optimal solution of subproblems
-
-
-
my intro: project experience, why am i interested in fb, etc.
-