lec14&15

lec14&15 - Discrete Computation Structures CSE 2353...

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

View Full Document Right Arrow Icon
Discrete Computation Structures CSE 2353 Bhanu Kapoor, PhD Department of Computer Science & Engineering Southern Methodist University, Dallas, TX [email protected] , 214-336-4973 October 15 and 20, 2009 Embrey 129, SMU, Dallas, Texas Lectures 14 and 15 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
Lecture 12 & 13 Agenda ± Binomial Coefficients ± Recurrence 2
Background image of page 2
Binomial Coefficients ALGORITHM 7.3: Determine C ( n , r ) using dynamic rogramming programming. ± Input: n , r , n > 0, r > 0, r n ± Output: C ( n , r ) nction combDynamicProg n r) 1. function combDynamicProg (n,r) 2. begin 3. for i := 0 to n do 4. for j := 0 to min(i,r) do j( , ) 5. if j = 0 or j = i then 6. C[i,j] := 1; 7. else 8. C[i,j] := C[i-1, j-1] + C[i-1, j]; 9. return C[n, r]; 10. end 3
Background image of page 3

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

View Full DocumentRight Arrow Icon
Sequences and Recurrence Relations 4
Background image of page 4
Sequences and Recurrence Relations 5
Background image of page 5

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

View Full DocumentRight Arrow Icon
Sequences and Recurrence Relations 6
Background image of page 6
Sequences and Recurrence Relations 7
Background image of page 7

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

View Full DocumentRight Arrow Icon
Sequences and Recurrence Relations 8
Background image of page 8
Sequences and Recurrence Relations 9
Background image of page 9

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

View Full DocumentRight Arrow Icon
10
Background image of page 10
Linear Homogenous Recurrence Relations 11
Background image of page 11

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

View Full DocumentRight Arrow Icon
Linear Homogenous Recurrence Relations 12
Background image of page 12
Linear Homogenous Recurrence Relations 13
Background image of page 13

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

View Full DocumentRight Arrow Icon
Linear Homogenous Recurrence Relations 14
Background image of page 14
Linear Homogenous Recurrence Relations 15
Background image of page 15

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

View Full DocumentRight Arrow Icon
Linear Homogenous Recurrence Relations 16
Background image of page 16
17
Background image of page 17

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

View Full DocumentRight Arrow Icon
18
Background image of page 18
Design and Analysis of Algorithms nalysis: redict the cost of an algorithm in terms of Analysis: predict the cost of an algorithm in terms of resources and performance Design: design algorithms which minimize the cost Hard Problems: for some problems no efficient algorithms exist => NP-Complete problems, Equally important to know that you are dealing with such a problem. 19
Background image of page 19

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

View Full DocumentRight Arrow Icon
Why algorithms are important? ± Total system performance depends upon both hardware and software ² Hardware with high clock rates ² Pipelining ² Superscalar architecture ² Very high speed networking ± Poor choice of algorithm can bring the highest performing machine to its knees ² Problem sizes that we are dealing with is also increasing ² Complexity of solution needed is also increasing 20
Background image of page 20
Analysis of Algorithms ± An algorithm is a finite set of precise instructions for performing a computation or for solving a problem. ± What is the goal of analysis of algorithms? o compare algorithms mainly in terms of running ² To compare algorithms mainly in terms of running time but also in terms of other factors (e.g., memory requirements, programmer's effort etc.) hat do we mean by running time analysis? ± What do we mean by running time analysis? ² Determine how running time increases as the size of the problem increases . 21
Background image of page 21

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

View Full DocumentRight Arrow Icon
Example: Searching ± Problem of searching an ordered list . ² Given a list L of n elements that are sorted into a definite order ( e.g. , numeric, alphabetical), ² And given a particular element x , ² Determine whether x appears in the list, and if so, return its index (position) in the list. 22
Background image of page 22