Final Review Flashcards
Time complexity of naive string matcher.
Preprocessing = 0
worst matching time = O((n-m+1)m)
Average matching time with few spurious hits = O(n-m + 1)
Time complexity of Rabin-Karp
Preprocessing = theta(m)
Matching time = O(n-m+1)m)
Time complexity of Finite automaton
Preprocessing = O(m|E|)
Matching time = theta(n)
Total time including preprocessing =
Time complexity of KMP
Preprocessing - theta(m)
Matching time = O(n)
Total = O(m+n)
Time complexity of adjacency list
O(V) + O(E)
Time complexity of adjacency matrix
O(V^2)
Graph Union
O(n^2)
BFS
queueing = O(V) Total = O(V+E)
DFS
O(V+E)
All-pairs shortest paths
O(V^3)
Matirix Multiplication
O(n^3)
Quick sort
O(nlogn)
Binary search
O(logn)
Linear
O(n)
Parsing over string twice
O(n^2)
Dijkstra’s time complexity
O(VE + E*log(V))