An algorithm is a precise method for solving problems, characterized by uniqueness, input, output, finiteness, and unambiguity. The analysis of algorithms focuses on their efficiency, determined by time and space complexity, and is evaluated through worst, average, and best case scenarios. Asymptotic notations such as Big Oh, Big Omega, and Big Theta are used to represent the complexities of algorithms, providing upper and lower bounds for their performance.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
11 views11 pages
Daa Unit 1
An algorithm is a precise method for solving problems, characterized by uniqueness, input, output, finiteness, and unambiguity. The analysis of algorithms focuses on their efficiency, determined by time and space complexity, and is evaluated through worst, average, and best case scenarios. Asymptotic notations such as Big Oh, Big Omega, and Big Theta are used to represent the complexities of algorithms, providing upper and lower bounds for their performance.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11
Algorithm & its Analysis
⚫ An algorithm is a complete, detailed and precise
step-by-step method for solving a problem independently of the software or hardware of the computer. Characteristics of an Algorithm ⚫ Uniqueness- Each step of an algorithm is unique and self-explanatory ⚫ Input- An algorithm receives Input ⚫ Output- An algorithm produces Output ⚫ Finiteness-Algorithm must stop after finite number of steps ⚫ Unambiguous- Algorithm should be clear and unambiguous i.e. each step of an algorithm should be clear and must lead to only one meaning. Analysis of an algorithm ⚫ Efficiency of an algorithm means how fast it can produce the correct result for the given problem.The efficiency of an algorithm depends upon its Time complexity and Space Complexity. ⚫ Space Complexity-amount of memory required by an algorithm for its execution. ⚫ Time Complexity-amount of time required by an algorithm for its execution. ⚫ There are three types of cases to analyze the algorithm: ⚫ Worst Case- Maximum no. of steps taken and maximum amount of time taken by an algorithm for its execution. ⚫ Average case- Average no. of steps taken and average amount of time taken by an algorithm for its execution. ⚫ Best case- Minimum no. of steps taken and minimum amount of time taken by an algorithm for its execution. Asymptotic Notations ⚫ These are the mathematical tools to represent the complexities of algorithms. There are 5 types of Notations: ⚫ Big Oh Notation(O) ⚫ Big Omega Notation(Ω) ⚫ Theta Notation(Θ) ⚫ Little o Notations(o) ⚫ Little ω Notations (ω). Big Oh Notation Big-Oh (O) notation gives an upper bound for a function f(n) to within a constant factor. f(n) = O(g(n)), If there are positive constantsn0 and c such that, to the right of n0 the f(n) always lies on or below c*g(n). O(g(n)) = { f(n) : There exist positive constant c and n0 such that 0 ≤ f(n) ≤ c g(n), for all n ≥ n0} ⚫ Big Omega Notation ⚫ Big-Omega (Ω) notation gives a lower bound for a function f(n) to within a constant factor. ⚫ f(n) = Ω(g(n)), If there are positive constants n0 and c such that, to the right of n0 the f(n) always lies on or above c*g(n). ⚫ Big Theta Notation ⚫ Big-Theta(Θ) notation gives bound for a function f(n) to within a constant factor. ⚫ f(n) = Θ(g(n)), If there are positive constantsn0 and c1 and c2 such that, to the right of n0 the f(n) always lies between c1*g(n) and c2*g(n) inclusive. Little-o notation ⚫ Denotes upper bound that is not asymptotically tight or loose upper bound. ⚫ if f(n)=o(g(n)) ⚫ Then these 2 conditions must be satisfied ⚫ 1. f(n)<c.g(n) ⚫ 2. Little or small (ω) Notation ⚫ Denotes lower bound that is not asymptotically tight or loose lower bound of f(n). ⚫ if f(n) = ω(g(n) ⚫ Then these two conditions must satisfy: ⚫ 1. f(n)>c.g(n) ⚫ 2. Ratio of f(n)/g(n)=∞ where lim n-> ∞