Please enable JavaScript.
Coggle requires JavaScript to display documents.
FREQUANCY COUNT METHOD, FREQUANCY COUNT METHOD - Coggle Diagram
FREQUANCY COUNT METHOD
FREQUANCY COUNT METHOD
Frequency count method
Time taken to sum all element of Array
Each statement takes 1 unit of time
Iterating Statement takes time equal to number of Iteration
time = 2n +3
so time complexity is O(n) order of n
Polynomial has degree of n
space = n +3 (A, n, s, i)
so time complexity is O(n) order of n
Analysis of Algorithm with loops
nested loops
Sum of All elements in an array
Adding 2 Matrices
f(n) = n^2 + 2n + 3
Degree of f(n) => O(n^2)
Space Complexity
S(n) = 3n^2 + 3
Degree of S(n) => O(n^2)
Multiplying 2 Matrices
Time Complexity = O(n^3)
Space Complexity = O(n^2)