Algorithm_Complexity_Time_Space_Tradeoff
Algorithm_Complexity_Time_Space_Tradeoff
- It tells how much time and memory (space) an algorithm needs to run and solve a problem.
1. Time Complexity:
- It shows how much time an algorithm takes depending on the input size.
Example:
If you have an array of 5 elements and check each one - Time = O(n)
2. Space Complexity:
- It shows how much memory (RAM) is used during the execution of an algorithm.
Example:
Time-Space Trade-off:
- Sometimes, you can use more memory to save time OR use more time to save memory.
Example:
Summary Table:
Concept - Meaning
---------------------|-------------------------------------------