Theory of Computing Lecture 1 MAS 714 Hartmut Klauck.

Slides:



Advertisements
Similar presentations
Turing Machines January 2003 Part 2:. 2 TM Recap We have seen how an abstract TM can be built to implement any computable algorithm TM has components:
Advertisements

Models of Computation Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Analysis of Algorithms Week 1, Lecture 2.
Algorithms (and Datastructures) Lecture 3 MAS 714 part 2 Hartmut Klauck.
CHAPTER 2 ALGORITHM ANALYSIS 【 Definition 】 An algorithm is a finite set of instructions that, if followed, accomplishes a particular task. In addition,
Analysis of Algorithms
Razdan with contribution from others 1 Algorithm Analysis What is the Big ‘O Bout? Anshuman Razdan Div of Computing.
02/01/11CMPUT 671 Lecture 11 CMPUT 671 Hard Problems Winter 2002 Joseph Culberson Home Page.
Algorithmic Complexity Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
Chapter 3 Growth of Functions
CS 206 Introduction to Computer Science II 09 / 10 / 2008 Instructor: Michael Eckmann.
Introduction to Analysis of Algorithms
CS421 - Course Information Website Syllabus Schedule The Book:
Computability and Complexity 32-1 Computability and Complexity Andrei Bulatov Boolean Circuits.
EECS 598: Background in Theory of Computation Igor L. Markov and John P. Hayes
Lecture 3 Aug 31, 2011 Goals: Chapter 2 (algorithm analysis) Examples: Selection sorting rules for algorithm analysis discussion of lab – permutation generation.
Analysis of Algorithms COMP171 Fall Analysis of Algorithms / Slide 2 Introduction * What is Algorithm? n a clearly specified set of simple instructions.
Design and Analysis of Algorithms
Lecture 2 MAS 714 Hartmut Klauck
Algorithm Design and Analysis Liao Minghong School of Computer Science and Technology of HIT July, 2003.
Instructor Neelima Gupta
1 i206: Lecture 6: Math Review, Begin Analysis of Algorithms Marti Hearst Spring 2012.
COMPSCI 102 Introduction to Discrete Mathematics.
Asymptotic Growth Rates Themes –Analyzing the cost of programs –Ignoring constants and Big-Oh –Recurrence Relations & Sums –Divide and Conquer Examples.
Chapter 1 Algorithm Analysis
1 Complexity Lecture Ref. Handout p
1 Lecture 2: Parallel computational models. 2  Turing machine  RAM (Figure )  Logic circuit model RAM (Random Access Machine) Operations supposed to.
CS Algorithm Analysis1 Algorithm Analysis - CS 312 Professor Tony Martinez.
Introduction to Analysing Costs 2015-T2 Lecture 10 School of Engineering and Computer Science, Victoria University of Wellington  Marcus Frean, Rashina.
Lecture 2 Computational Complexity
Algorithm Efficiency CS 110: Data Structures and Algorithms First Semester,
Mathematics Review and Asymptotic Notation
1 Computer Algorithms Lecture 3 Asymptotic Notation Some of these slides are courtesy of D. Plaisted, UNC and M. Nicolescu, UNR.
Theory of Computing Lecture 15 MAS 714 Hartmut Klauck.
Analysis of Algorithms
Computational Complexity Theory Lecture 2: Reductions, NP-completeness, Cook-Levin theorem Indian Institute of Science.
1 COMP3040 Tutorial 1 Analysis of algorithms. 2 Outline Motivation Analysis of algorithms Examples Practice questions.
Analyzing algorithms & Asymptotic Notation BIO/CS 471 – Algorithms for Bioinformatics.
Fundamentals CSE 373 Data Structures Lecture 5. 12/26/03Fundamentals - Lecture 52 Mathematical Background Today, we will review: ›Logs and exponents ›Series.
Analysis of Algorithms CSCI Previous Evaluations of Programs Correctness – does the algorithm do what it is supposed to do? Generality – does it.
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
Week 12 - Wednesday.  What did we talk about last time?  Asymptotic notation.
1Computer Sciences Department. Book: Introduction to Algorithms, by: Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest Clifford Stein Electronic:
Program Efficiency & Complexity Analysis. Algorithm Review An algorithm is a definite procedure for solving a problem in finite number of steps Algorithm.
Theory of Computing Lecture 21 MAS 714 Hartmut Klauck.
ELEN 033 Lecture #1 Tokunbo Ogunfunmi Santa Clara University.
Algorithm Analysis CS 400/600 – Data Structures. Algorithm Analysis2 Abstract Data Types Abstract Data Type (ADT): a definition for a data type solely.
CS 206 Introduction to Computer Science II 09 / 18 / 2009 Instructor: Michael Eckmann.
Prof. Amr Goneid, AUC1 Analysis & Design of Algorithms (CSCE 321) Prof. Amr Goneid Department of Computer Science, AUC Part 1. Complexity Bounds.
CS 206 Introduction to Computer Science II 01 / 30 / 2009 Instructor: Michael Eckmann.
ADS 1 Algorithms and Data Structures 1 Syllabus Asymptotical notation (Binary trees,) AVL trees, Red-Black trees B-trees Hashing Graph alg: searching,
Algorithm Analysis (Big O)
ANALYSING COSTS COMP 103. RECAP  ArrayList: add(), ensuring capacity, iterator for ArrayList TODAY  Analysing Costs 2 RECAP-TODAY.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture1.
Introduction to Analysing Costs 2013-T2 Lecture 10 School of Engineering and Computer Science, Victoria University of Wellington  Marcus Frean, Rashina.
Analysis of Algorithms
Introduction to Analysing Costs
Analysis of algorithms
Great Theoretical Ideas in Computer Science
Growth of functions CSC317.
CS 583 Fall 2006 Analysis of Algorithms
Objective of This Course
Introduction to Algorithms Analysis
CSE838 Lecture notes copy right: Moon Jung Chung
Chapter 2.
Algorithm Analysis and Design
Introduction to Discrete Mathematics
Analysis of algorithms
Design and Analysis of Algorithms
Presentation transcript:

Theory of Computing Lecture 1 MAS 714 Hartmut Klauck

Organization: Lectures: Tue 9:30-11:30 TR+20 Fr 9:30-10:30 Tutorial: Fr:10:30-11:30 Exceptions: This week no tutorial, next Tuesday no lecture

Organization Final: 60%, Midterm: 20%, Homework: 20% Homework 1 out on Aug. 15, due on Aug. 15

Books: Cormen Leiserson Rivest Stein: Introduction to Algorithms Sipser: Introduction to the Theory of Computation Arora Barak: Computational Complexity- A Modern Approach

Computation Computation: Mapping inputs to outputs in a prescribed way, by small, easy steps Example: Division – Div(a,b)=c such that bc=a How to find c? School method

Outline: Theory of Computing

This course First half: algorithms and data-structures Second half: Some complexity, computability, formal languages – NP-completeness – Computable and uncomputable problems – Time-hierarchy – Automata and Circuits

Algorithms An algorithm is a procedure for performing a computation Algorithms consist of elementary steps/instructions Elementary steps depend on the model of computation – Example: C++ commands

Algorithms: Example Gaussian Elimination – Input: Matrix M – Output: Triangular Matrix that is row-equivalent to M – Elementary operations: row operations swap, scale, add

Algorithms Algorithms are named after Al-Khwārizmī ( Abū ʿAbdallāh Muḥammad ibn Mūsā al-Khwārizmī ) c ce Persian mathematician and astronomer (Algebra is also named after his work) His works brought the positional system of numbers to the attention of Europeans

Algorithms: Example Addition via the school method: – Write numbers under each other – Add number position by position moving a „carry“ forward Elementary operations: – Add two numbers between 0 and 9 (memorized) – Read and Write Can deal with arbitrarily long numbers!

Datastructure The addition algorithm uses (implicitly) an array as datastructure – An array is a fixed length vector of cells that can each store a number/digit – Note that when we add x and y then x+y is at most 1 digit longer than max{x,y} – So the result can be stored in an array of length n+1

Multiplication The school multiplication algorithm is an example of a reduction First we learn how to add n numbers with n digits each To multiply x and y we generate n numbers x i ¢ y ¢ 2 i and add them up Reduction from Multiplication to Addition

Complexity We usually analyze algorithms to grade the performance The most important (but not the only) parameters are time and space Time refers to the number of elementary steps Space refers to the storage needed during the computation

Example: Addition Assume we add two numbers x,y with n decimal digits Clearly the number of elementary steps (adding digits etc) grows linearly with n Space is also ¼ n Typical: asymptotic analysis

Example: Multiplication We generate n numbers with at most 2n digits, add them Number of steps is O(n 2 ) Space is O(n 2 ) Much faster algorithms exist – (but not easy to do with pen and paper) Question: Is multiplication harder than addition? – Answer: we don‘t know...

Our Model of Computation We could use Turing machines... Will consider algorithms in a richer model, a RAM RAM: – random access machine Basically we will just use pseudocode/informal language

RAM Random Access Machine – Storage is made of registers that can hold a number (an unlimited amount of registers is available) – The machine is controlled by a finite program – Instructions are from a finite set that includes Fetching data from a register into a special register Arithmetic operations on registers Writing into a register Indirect addressing

RAM Random Access Machines and Turing Machines can simulate each other There is a universal RAM RAM’s are very similar to actual computers – machine language

Computation Costs The time cost of a RAM step involving a register is the logarithm of the number stored – logarithmic cost measure – adding numbers with n bits takes time n etc. The time cost of a RAM program is the sum of the time costs of its steps Space is the sum (over all registers ever used) of the logarithms of the maximum numbers stored in the register

Other Machine models Turing Machines (we will define them later) Circuits Many more! A machine model is universal, if it can simulate any computation of a Turing machine RAM’s are universal – Vice versa, Turing machines can simulate RAM’s

Types of Analysis Usually we will use asymptotic analysis – Reason: next year‘s computer will be faster, so constant factors don‘t matter (usually) – Understand the inherent complexity of a problem (can you multiply in linear time?) – Usually gives the right answer in practice Worst case – The running time of an algorithm is the maximum time over all inputs – On the safe side for all inputs…

Types of Analysis Average case: – Average under which distribution? – Often the uniform distribution, but may be unrealistic Amortized analysis – Sometimes after some costly preparations we can solve many problem instances cheaply – Count the average cost of an instance (preparation costs are spread between instances) – Often used in datastructure analysis

Asymptotic Analysis Different models lead to slightly different running times – E.g. depending on the instruction set Also computers become faster through faster processors – Same sequence of operations performed faster Therefore we generally are not interested in constant factors in the running time – Unless they are obscene

O, , £ Let f,g be two monotone increasing functions that send N to R + f=O(g) if 9 n 0,c 8 n>n 0 : f(n) · c g(n) Example: f(n)=n, g(n)=1000n+100 ) g(n)=O(f(n)) – Set c=1001 and n 0 =100 Example: f(n)=n log n, g(n)=n 2

O, , £ Let f,g be two monotone increasing functions that send N to R + f =  (g) iff g=O(f) – Definition by Knuth f = £ (g) iff [ f=O(g) and g=O(f) ] o, ! : asymptotically smaller/larger E.g., n=o(n 2 ) But 2n n= £ (n 2 )

Some functions 2n+10 n 2 /500 n log(n)/2