FUCK Flashcards
What is ln(e^n) and e^ln(n) =
n
Log Rules
Product: loga(xy) = loga(x) + loga(y)
Quotient: loga(x/y) = loga(x) - loga(y)
Power: loga(x^y) = yloga(x)
Quick Sort
Divides problem into two parts. Pick a pivot to split elements left and right if smaller or larger
Merge Sort
Divides until length 1 merges and sorts list recombining them
Big O Equation
G(n) less than or equal to c * f(n)
Big Omega Equation
G(n) greater than or equal to c * f(n)
Theta Equation
G is in Big O(f) and Big Omega(f)
Small o Equation
Lim
G(n) / f(n) = 0
N -> Infinity
Small Omega Equation
Lim
F(n) / g(n) = 0
N -> Infinity
Interpretation
Big O - G does not grow sig faster than f
Big Omega - G does not grow sig slower than f
Theta - G grows as fast as f
Small o - g grows sig slower than f
Small omega - g grows sig faster than f
Graph Definition
Undirected graph consists of vertex set and edge set where every edge connects two vertices referred to as nodes
Edge Definition
An edge connects two vertices, each vertex being an endpoint
Walk
Sequence of edges and vertices and every edge has both endpoints. If first vertex = last vertex the walk is closed
Trail
A trail is a walk where all edges are distinct
Path
A walk in which all vertices are distinct
Circuit
A closed trail
Cycle
A circuit where only the first and last vertex are equal
What is an inner node
Any node with children
Height of a tree
Length of longest path to from root to any leaf
Depth of a node
Length of path to its root
Height of a node
Length of longest downward path to a leaf from that node
Level of a tree
Level starts from 0 at root and increases for each level of children
Tree Definition
A cycle free connected graph
Depth first search
Searches “deeper” in the graph when possible exploring subtrees on the right first
Breadth first search
Explores all in the same level
Binary Search Tree
Stores keys in the vertices, key stored must be greater than every key in left sub and smaller than every key in right sub
Insert function
Search for key, if not found keep going till vertex found with no children add left or right accordingly