100 likes | 110 Views
Prepare for your algorithms midterm exam with key topics like finding primes in Euler's number, time complexity of sorting algorithms, dynamic programming, and asymptotic notations. Includes explanations and examples for each concept. Get ready to ace your exam!
E N D
Review for Midterm Exam Andreas Klappenecker
Topics Covered • Finding Primes in the Digits of Euler's Number • Asymptotic Notations: Big Oh, Big Omega, Big Theta • Time complexity of Insertion Sort • Lower bounds for sorting • Divide-and-Conquer Algorithms • Mergesort • Strassen's method for Matrix Multiplication • Greedy Algorithms, Huffman codes • Greedy Algorithms for Matroids • Matroid Embeddings • Dynamic Programming, Matrix Chain Multiplication • Dynamic Programming, Longest Common Subsequence • Amortized Analysis • Disjoint Sets
Asymptotic Notations O(g) = { f:N->R | there exists an integer n0 and a real constant C such that |f(n)| <= C|g(n)| for all n>= n0 } (g) = { f:N->R | there exists an integer n0 and a real constant c such that |f(n)| => c|g(n)| for all n>= n0 }
Asymptotic Notation • ½(n2+n+6) = O(n2) • 6n2 = O(n2) • 10765432n2+2n+7= (n2) • ½(n2+n+6) = (n2) • (g) = (g) O(g) • ½(n2+n+6) = (n2)
Sorting • Insertion Sort • Best case running time: linear • Worst case running time: quadratic • Merge Sort O(n log n) • Any comparison based sorting (n log n)
Divide-and-Conquer • Mergesort • Quicksort • Strassen’s matrix multiplication algorithm • Recurrence relations • Master theorem (no need to memorize)
Greedy Algorithms • Coin change • Huffman codes • Matroids • Kruskal’s algorithm • Matroid embeddings • Prim’s algorithm
Dynamic Programming • Matrix chain multiplication • Longest common subsequences • Variations: Edit distance
Amortized Analysis • Aggregate Analysis • Accounting Method • Stacks • Counter • Disjoint Sets
Exam • Some short questions • Some workout problems • Lectures • Slides • Textbook • Quizzes • Homework