Algorithms-Analysis of Algorithms-Lecture Slides, Slides of Design and Analysis of Algorithms

This lecture was delivered by Anshuman Vibha at Ankit Institute of Technology and Science for Analysis of Algorithms course. It includes: Algorithms, Computational, Procedure, Data, Structure, Modifications, Time, Complexity, Running, Examples

Typology: Slides

2011/2012

Uploaded on 07/14/2012

sharma-raju
sharma-raju 🇮🇳

4.5

(2)

15 documents

1 / 22

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Algorithms
An algorithm is a well-defined
computational procedure that takes some
value, or set of values, as input and
produces some value or set of values as
output.
A data structure is a way to store and
organize data in order to facilitate access
and modifications.
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16

Partial preview of the text

Download Algorithms-Analysis of Algorithms-Lecture Slides and more Slides Design and Analysis of Algorithms in PDF only on Docsity!

Algorithms

• An algorithm is a well-defined

computational procedure that takes some

value, or set of values, as input and

produces some value or set of values as

output.

• A data structure is a way to store and

organize data in order to facilitate access

and modifications.

Time Complexity

• Amount of time taken by an algorithm to

run as a function of size

  • Worst case
  • Average case
  • Best case

Running Time

Name

Running time ( T ( n ))

Examples of running times

linear time O ( n ) n

linearithmic time O ( n log n ) n log n , log n!

quadratic time O ( n^2 ) n^2

polynomial time poly( n ) n , n log n , n^10

exponential time 2 poly( n )^ n !, nn , 2 n^2

factorial time O ( n !) n!

Assignment 1 (Cormen Problem 1.1)

Determine the largest size n of a problem that

can be solved in the given time t if the

problem takes f(n) microseconds

1 sec 1 min 1 hr 1 day I year 1 century n

log n n log n n^2 2 n n!

Notations

• Big O ; For the asymptotic upper bound we

use O-notation

O(g(n))={f(n): there exists positive

constants c and n 0 such that

0 ≤ f(n) ≤ c g(n) for all n ≥ n 0

Notations

• Big Omega Notation (Ω) asymptotically

bounds a function from below.

Ω(g(n)) ={f(n) : there exists a positive

constant c and n 0 such that

0 ≤ c g(n) ≤ f(n) for all n ≥ n 0

Notations

• Little o is similar to big but may or may not

be asymptotic tight upper bound.

o(g(n))={f(n): for any positive constants c>

there exists a constant n 0 >0 such that

0 ≤ f(n) < c g(n) for all n ≥ n 0

Notations

• Little ω is similar to big Ω but may or may

not be asymptotic tight lower bound.

ω(g(n))={f(n): for any positive constants c>

there exists a constant n 0 >0 such that

0 ≤ c g(n) < f(n) for all n ≥ n 0

We may define it as

f(n) Є ω(g(n)) if and only if g(n) Є o(f(n))

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.