Computer Science - Algorithms - Time and space complexity - Time vs Space Trade-off
Scenario: 'You need to check if a list has duplicates. Two approaches:' Approach A (Time-efficient): 'Store all seen numbers in a set. For each number, check if it's in the set. If yes → duplicate! Time: O(n). Space: O(n) - the set.' Approach B (Space-efficient): 'Compare every pair of numbers. No e