β¨ Nested for statement : [object Object] time complexity
for (let i = 0; i < N;; i += 1) {
for (let j = i + 1; j < N; j += 1) {
}
}
β¨ For statement for fixed and relatively small number
- It doesn't depend on the input data size.
- If its size is relatively small and its value is fixed, the overall time complexity is much faster than that.
π for alphabets (26) :
for (let i = 0; i < 26; i += 1) {
for (let j = i + 1; j < 26; j += 1) {
}
}
π for data ranges (50) :
for (let i = -50; i < 0; i += 1) {
}
ποΈ Typical problems