Summary of "Time and Space Complexity - Strivers A2Z DSA Course"

Summary of "Time and Space Complexity - Strivers A2Z DSA Course"

This video lecture from Striver’s A2Z DSA Course introduces the fundamental concepts of Time Complexity and Space Complexity, focusing on their importance in coding interviews and how to analyze them practically.


Main Ideas and Concepts

1. What is Time Complexity?

2. Why Time Complexity is Important

3. How to Compute Time Complexity

4. Three Important Rules When Computing Time Complexity

5. Best Case, Average Case, Worst Case

6. Big O notation

7. Other Notations (Briefly Mentioned)


Examples and Methodologies

for (int i = 1; i < n; i++) {
    cout << "Raj";
}

Time Complexity: O(n) because it runs n times.

for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
        // constant time operation
    }
}

Time Complexity: O(n²) because inner loop runs n times for each iteration of outer loop.

for (int i = 0; i < n; i++) {
    for (int j = 0; j <= i; j++) {
        // constant time operation
    }
}

Time Complexity: O(n²), derived from sum of first n natural numbers: n(n+1)/2.


Space Complexity


Practical Tips for Competitive Programming


Summary of Methodology to Analyze Time Complexity


Summary of Methodology to Analyze Space

Category ?

Educational

Share this summary

Video