2011-CS9-umans

2011-CS9-umans - 10/14/2011 Theoretical Computer Science...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
10/14/2011 1 Theoretical Computer Science Algorithms and Complexity Chris Umans October 12, 2011 2 Theoretical Computer Science Algorithms Systems and Software Design and Implementation Computability and Complexity Theory October 12, 2011 3 Theoretical Computer Science • At the heart of computer programs lie algorithms • To study algorithms we must be able to speak mathematically about: – computational problems – computers – algorithms October 12, 2011 4 Theoretical Computer Science • At the heart of computer programs lie algorithms • To study algorithms we must be able to speak mathematically about: – computational problems : functions on bitstrings – computers: Turing Machines – algorithms: step-by-step instructions Algorithms (example) Input: n numbers Output: n numbers in ascending order Algorithms for this problem? How do you know which one is “better”? October 12, 2011 5 7 5 6 9 2 3 1 4 1 2 3 4 5 6 7 9 October 12, 2011 6 Worst-case, asymptotic analysis • measure running time as a function of input length • f(n) is worst-case over all n-bit inputs 3n 2 +100 2 n /30 • “efficient,” “tractable” = polynomial • “prohibitive,” “intractable” = exponential
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10/14/2011 2 Algorithms • lots of non-obvious and beautiful ideas that lead to fast algorithms • Example: matrix multiplication • Standard method: O(n 3 ) operations October 12, 2011 7 X = A B C October 12, 2011 8 Strassen’s Algorithm linear combos of A, B entries 7 mults linear combos of results X = a 1, 1 a 1, 2 a 2, 2 a 2, 1 b 1, 1 b 1, 2 b 2, 2 b 2, 1 c 1, 1 c 1, 2 c 2, 2 c 2, 1 (a 1,1 - a 1,2 ) (b 2,1 + b 2,2 ) (a 1,1 + a 2,2 ) (b 1,1 + b 2,2 ) (a 1,1 - a 2,1 ) (b 1,1 + b 1,2 ) (a 1,1 + a 1,2 ) (b 2,2 ) (a 1,1 ) (b 1,2 + b 2,2 ) (a 2,2 ) (b 2,1 - b 1,1 ) (a 2,1 - a 2,2 ) (b 1,1 ) P 1 = (a 1,1 - a 1,2 ) × (b 2,1 + b 2,2 ) P 2 = (a 1,1 + a 2,2 ) × (b 1,1 + b 2,2 ) P 3 = (a 2,1 ) × (b 1,1 + b 1,2 ) P 4 = (a 1,1 + a 1,2 ) × (b 2,2 ) P 5 = (a 1,1 ) × (b 1,2 + b 2,2 ) P 6 = (a 2,2 ) × (b 2,1 - b 1,1 ) P 7 = (a 2,1 - a 2,2 ) × (b 1,1 ) c 1,1 = P 1 + P 2 - P 4 + P 6 c 1,2 = P 4 + P 5 c 2,1 = P 6 + P 7 c 2,2 = P 2 - P 3 + P 5 - P 7 October 12, 2011 9 Strassen’s Algorithm • T(n) = # operations to multiply n x n matrices T(n) ≤ 7 T(n/ 2 ) + O(n 2 ) T(n) ≤ O(n log 2 7 ) (huge difference for huge matrices) can multiply n x n matrices in time O(n 2.81… ) ! Algorithms
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 7

2011-CS9-umans - 10/14/2011 Theoretical Computer Science...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online