In my job I had to implement an algorithm, the specifics details does not matters, but I was unable to have a clear answer about the time complexity of this specific algorithm.
In a nutshell it's look like something like that:
for(let i = 0; i < 3; i++) {
for(let j = 0; j < n - 1; j++) {
for(let k = 0; k < 8; k++ {
// Do some stuff
}
}
}
What is the time complexity of this algorithm ?
At the beginning I thought it would be something like O(n^3). But the more I think about, the more I think it's actually more a 0(n). Because, even though we have 3 for loop, only one can be of a variable size, the two other are constant.
So what is the actual time complexity of this algorithm ? Is it O(n^3), O(n) or even something else ?
