# 3 - INTRODUCTION Objective: Algorithms Techniques Analysis....

This preview shows pages 1–8. Sign up to view the full content.

Abdelghani Bellaachia, Algorithms - 1 - INTRODUCTION Objective: ü Algorithms ü Techniques ü Analysis. Algorithms: ü Definition: An algorithm is a sequence of computational steps that take some value, or set of values, as input and produce some value, or set of values, as output. ü Pseudocode: An easy way to express the idea of an algorithm (very much like C/C++, Java, Pascal, Ada, … )

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

View Full Document
Abdelghani Bellaachia, Algorithms - 2 - Techniques Divide and Conquer The greedy method Dynamic programming Backtracking Branch and Bound
Abdelghani Bellaachia, Algorithms - 3 - Analysis of Algorithms ˜ Motivation: Estimation of required resources such as memory space, computational time, and communication bandwidth. Comparison of algorithms. ˜ Model of implementation: One-processor RAM (random-access machine) model. comparison operation, take constant time. ˜ Cost: Time complexity: ü total # of operations as a function of input size, also called running time, computing time. Space complexity: ü total # memory locations required by the algorithm.

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

View Full Document
Abdelghani Bellaachia, Algorithms - 4 - Asymptotic Notation Objective: What is the rate of growth of a function? What is a good way to tell a user how quickly or slowly an algorithm runs? Definition: A theoretical measure of the comparison of the execution of an algorithm , given the problem size n, which is usually the number of inputs. To compare the rates of growth: Big-O notation: Upper bound Omega notation: lower bound Theta notation: Exact notation
Abdelghani Bellaachia, Algorithms - 5 - 1- Big- O notation: ü Definition: F(n)= O( f(n) ) if there exist positive constants C n0 such that F(n) c*f(n) when n n0 ü F(n) is an upper bound of F(n). ü Examples: F(n)= 3n+2 What is the big-O of F(n)? F(n)=O(?) For 2 n 3n+2 3n+n=4n F(n)= 3n+2 4n F(n)=O(n) Where C=4 and n0=2 F(n)=62 n +n2 What is the big-O of F(n)? F(n)=O(?) For n 2 2 n is true only when n 4 62 n +n 2 62 n +2 n =7*2 n c=7 n0=4 F(n) 7*2 n F(n)= O(2 n )

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

View Full Document
Abdelghani Bellaachia, Algorithms - 6 - ü Theorem: If F(n)= a m n m + a m-1 n m-1 +...+ a 1 n+a 0 = = m 0 i i i n a Then f(n)= O(n m ) Proof: F(n) = m 0 i i i n a n m * = - m 0 i m i i n a Since n i-m 1 |a i | n i-m |a i | = - m 0 i m i i n a = m 0 i i a F(n) n m * = m 0 i i a for n 1 F(n) n m * c where c= = m 0 i i a F(n)= O(n m ) O(log n) < O(n) < O(n log n) < O(n 2 ) < O(n 3 ) < O(2 n )
Abdelghani Bellaachia, Algorithms - 7 - 2- Omega notation: ü Definition: F(n)= (f(n))

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This document was uploaded on 09/03/2010.

### Page1 / 22

3 - INTRODUCTION Objective: Algorithms Techniques Analysis....

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

View Full Document
Ask a homework question - tutors are online