Final Exam Flashcards
running times of insertion sort
o Best case: O(n)
o Worst case: O(n^2)
o Average case: O(n^2)
running times of bubble sort
o Best case: O(n)
o Worst case: O(n^2)
o Average case: O(n^2)
running times of heap sort
o Best case: O(n log n)
o Worst case: O(n log n)
o Average case: O(n log n)
running times of merge sort
o Best case: O(n log n)
o Worst case: O(n log n)
o Average case: O(n log n)
recurrence relationship for merge sort
T(n) = 2T(n/2) + O(n) n > 1
O(1) n = 1
running times for quick sort
o Best case: O(n log n)
o Worst case: O(n^2)
o Average case: O(n log n)
running time and recurrence for quick sort with a 8 to 3 split
RT = O(n log n)
T(n) = T(8n/11) + T(3n/11) + O(n) n > 1
O(1) n = 1
recurrence relationship for worst case of quick sort
T(n) = T(n-1) + O(n) n > 1
O(1) n = 1
Djikstras priority queue implemented with array: running times for insert, decrease key, and delete min
insert: O(1)
decreasekey: O(1)
deletemin: O(n)
Djikstras priority queue implemented with binary heap: running times for insert, decrease key, and delete min
insert: O(log n)
decreasekey: O(log n)
deletemin: O(log n)
running times for search, insert, and delete on regular binary search tree with n nodes
O(h) where h is the height of the tree . . . or O(n)
running times for search, insert, and delete in a red-black tree with n internal nodes
O(log n)
running time for topological ordering (linearization) algorithm
O(|V| + |E|)
running time for longest common string
O(n * 2^m)
running time for edit distance
O(n * m)