KEMBAR78
Python algorithm efficency | PPTX
Idea of Algorithmic Efficiency
Idea of Algorithmic Efficiency
Algorithm-
performance of Algorithm- depends on complexity/efficiency of
algorithm
Performance of algorithms depend on two factors:
Internal Factor
Time required to run
Space required to run
External Factor
Size of the input to the algorithm
Speed of the computer on which it is run
Quality of the compiler
Big O Notation-It is used to represent an algorithm’s growth rate.It
is a mathematical formula to best describe algorithm’s
performance.
(growth rate is O(N2)steps for an algorithm whose input size is N .
Guidelines for computing Complexity of
algorithm.
1. Select computational resource( time and memory)
2. Pay attention to loops or recursion, and identify size
of input.
3. Try to see different cases inside it. (best, worst,
average case) Takes maximum possible time to perform
Performs better than worst case but doesn’t
give best performance
Takes shortest possible time to perform.
Order to Determine Big-O notation for the following calculated complexity
1. A function has "constant" growth if its output does not change based on the input ‘n’ , or
have n0 ,111 and 100010001000 are constant.
2. A function has “logarithmic" growth if its output increases according to logarithmic expression. In this
case
log2(n) , n log2n , 3 log2 n ,log (n)
3. A function has "linear" growth if its output increases linearly with the size of its input i.e ‘n’. In this case
n,
3n, (3/2)n are linear.
4. A function has "polynomial" growth if its output increases according to a polynomial expression. In this
case, 3n2 , n3 are polynomial.
5.A function has "exponential" growth if its output increases according to an exponential expression. In this
case, 2n , (3/2)n are exponential.

Python algorithm efficency

  • 1.
  • 2.
    Idea of AlgorithmicEfficiency Algorithm- performance of Algorithm- depends on complexity/efficiency of algorithm Performance of algorithms depend on two factors: Internal Factor Time required to run Space required to run External Factor Size of the input to the algorithm Speed of the computer on which it is run Quality of the compiler Big O Notation-It is used to represent an algorithm’s growth rate.It is a mathematical formula to best describe algorithm’s performance. (growth rate is O(N2)steps for an algorithm whose input size is N .
  • 3.
    Guidelines for computingComplexity of algorithm. 1. Select computational resource( time and memory) 2. Pay attention to loops or recursion, and identify size of input. 3. Try to see different cases inside it. (best, worst, average case) Takes maximum possible time to perform Performs better than worst case but doesn’t give best performance Takes shortest possible time to perform.
  • 13.
    Order to DetermineBig-O notation for the following calculated complexity 1. A function has "constant" growth if its output does not change based on the input ‘n’ , or have n0 ,111 and 100010001000 are constant. 2. A function has “logarithmic" growth if its output increases according to logarithmic expression. In this case log2(n) , n log2n , 3 log2 n ,log (n) 3. A function has "linear" growth if its output increases linearly with the size of its input i.e ‘n’. In this case n, 3n, (3/2)n are linear. 4. A function has "polynomial" growth if its output increases according to a polynomial expression. In this case, 3n2 , n3 are polynomial. 5.A function has "exponential" growth if its output increases according to an exponential expression. In this case, 2n , (3/2)n are exponential.