| Auxiliary Space | extra space or temporary space used by an algorithm, excluding the space for the output
It does not use any data structures that grow with the input size, so the space complexity is O(1), which is constant. | | --- | --- | | Amortised | computes the average cost per operation over a (worst-case) sequence of operations by spreading occasional expensive steps across many cheap ones
• Although a single insert into a dynamic array may sometimes take O(n) when resizing, its amortised cost over n inserts is O(1). • Union-Find’s find uses path compression, giving O(α(N)) amortised per operation, which for practical N is constant. | | | | | | |
🎯 Mindset of a Strong Hire:
Clearly rephrase the problem statement back to the interviewer.
Example: "Just to confirm, given an unsorted array of integers, I need to return the indices of two numbers that sum up to a target value?"
[1, 2, 3, 4], target = 5 → [0, 3]
[]
), Single-element array ([1]
)[-1, 0, 2, -2, 3] target = 1
)