I am sorry for asking such a Dummy question but I can't seem to find the answer. I know how to calculate the complexity of an algorithm ( O() ) when there are loops'n stuff, but in this case I have difficulty wrapping my head around it. The language is C++.
Here's the code :
int calculate(int k, int n){ // Code C++
int firstSequenceEnd = k-1;
int sumAk = ((1 + (firstSequenceEnd))*(firstSequenceEnd) ) >> 1;
return (1 << n-k)*sumAk;
}
Thank you in advance !