- #1
doktorwho
- 181
- 6
Homework Statement
The kind of problems i we are currently dealing with in school are like this:
Find the order of complexity of the function
Homework Equations
3. The Attempt at a Solution [/B]
Im suppose to guess or calculate the complexity of this based on code sample. Its in Pascal and to clarify what is meant here here is an example of the code and its complexity
Code:
for k:=1 to n do
while x>0
k:=k+1
x:= x DIV 2
As i see this, the i<n part is repeated n times, but the s-part confuses me. I can't see ##2^n##