Add complexity video resource (#5399)
* feat/ Added complexity video resource Added video resource for time and space complexity in Data structures and Algorithms section. * Replace link --------- Co-authored-by: Kamran Ahmed <kamranahmed.se@gmail.com>pull/5413/head
parent
5230ae22be
commit
4e96a58e54
1 changed files with 3 additions and 1 deletions
@ -1,3 +1,5 @@ |
||||
# How to Calculate Complexity? |
||||
|
||||
The process of calculating algorithmic complexity, often referred to as Big O notation, involves counting the operations or steps an algorithm takes in function of the size of its input. The aim is to identify the worst-case, average-case, and best-case complexity. Generally, the main focus is on the worst-case scenario which represents the maximum number of steps taken by an algorithm. To calculate it, you consider the highest order of size (n) in your algorithm's steps. For instance, if an algorithm performs a loop 5 times for 'n' items, and then does 3 unrelated steps, it has a complexity of O(n), because the linear steps grow faster than constant ones as n increases. Other complexities include O(1) for constant complexity, O(n) for linear complexity, O(n^2) for quadratic complexity, and so on, based on how the steps increase with size. |
||||
The process of calculating algorithmic complexity, often referred to as Big O notation, involves counting the operations or steps an algorithm takes in function of the size of its input. The aim is to identify the worst-case, average-case, and best-case complexity. Generally, the main focus is on the worst-case scenario which represents the maximum number of steps taken by an algorithm. To calculate it, you consider the highest order of size (n) in your algorithm's steps. For instance, if an algorithm performs a loop 5 times for 'n' items, and then does 3 unrelated steps, it has a complexity of O(n), because the linear steps grow faster than constant ones as n increases. Other complexities include O(1) for constant complexity, O(n) for linear complexity, O(n^2) for quadratic complexity, and so on, based on how the steps increase with size. |
||||
|
||||
- [Time & Space Complexity](https://www.youtube.com/watch?v=Z0bH0cMY0E8) |
||||
|
Loading…
Reference in new issue