Presentation is loading. Please wait.

Presentation is loading. Please wait.

Algorithm analysis and design Introduction to Algorithms week1

Similar presentations


Presentation on theme: "Algorithm analysis and design Introduction to Algorithms week1"— Presentation transcript:

1 Algorithm analysis and design Introduction to Algorithms week1
Algorithm & its properties, Time & Space complexity, Asymptotic Notations. CS413

2 Algorithm & its properties
An algorithm is a sequence of computational steps that transforms the input into the output. An algorithm is a step by step procedure to solve a problem. It take a set of value as input and produces some value as output. The efficiency of an algorithm is based on the space and time complexity.

3 Algorithm & its properties
Properties of an algorithm Algorithms must contain finite number of steps Algorithms must be precise and unambiguous.

4 Algorithm Design and Analysis
The efficiency or running time of an algorithm is stated as a function relating the input length to the number of steps (time complexity) or storage locations (space complexity). Algorithm analysis provides theoretical estimates for the resources needed by any algorithm which solves a given computational problem.

5 Time & Space complexity
Space Complexity is the space (memory) needed for an algorithm to solve the problem. An efficient algorithm take space as small as possible. Time Complexity Time complexity is the time required for an algorithm to complete its process.It allows comparing the algorithm to check which one is the efficient one.

6 Asymptotic Notations Asymptotic notation is used to compute the complexity of an algorithm in terms of time and space. It is normally mentioned as the following terms. Big O notation Example: O(n2) Big Omega notation Example: Ω(n) Big Theta Example: Θ(n log n)

7 O-notation For function g(n), we define O(g(n)), big-O of n, as the set: O(g(n)) = {f(n) :  positive constants c and n0, such that n  n0, we have 0  f(n)  cg(n) } Intuitively: Set of all functions whose rate of growth is the same as or lower than that of g(n). g(n) is an asymptotic upper bound for f(n). f(n) = (g(n))  f(n) = O(g(n)). (g(n))  O(g(n)). Comp 122

8  -notation For function g(n), we define (g(n)), big-Omega of n, as the set: (g(n)) = {f(n) :  positive constants c and n0, such that n  n0, we have 0  cg(n)  f(n)} Intuitively: Set of all functions whose rate of growth is the same as or higher than that of g(n). g(n) is an asymptotic lower bound for f(n). f(n) = (g(n))  f(n) = (g(n)). (g(n))  (g(n)). Comp 122

9 -notation For function g(n), we define (g(n)), big-Theta of n, as the set: (g(n)) = {f(n) :  positive constants c1, c2, and n0, such that n  n0, we have 0  c1g(n)  f(n)  c2g(n) } Intuitively: Set of all functions that have the same rate of growth as g(n). g(n) is an asymptotically tight bound for f(n). f(n) and g(n) are nonnegative, for large n.


Download ppt "Algorithm analysis and design Introduction to Algorithms week1"

Similar presentations


Ads by Google