does CPU time reflect Big O time complexity?
WHAT I MADE
I implemented two Fibonacci functions in C programming language. The former has recursive behaviour while the latter has iterative behaviour.
I found out that the worst case scenario for the recursive version is exponential time (i.e. $2^n$) and linear time for the iterative one - since I have a simple loop within.
I then computed the CPU time for both the version using the
time.h C library.
WHAT I EXPECT
I expect those CPU values to be somehow related with that time complexity. Generally speaking, I expect way larger CPU times for the recursive version.
WHAT I GOT
I got the foregoing plot using MATLAB (that is a loglog plot of cpu times as function of $n$).
Seems like the CPU time for the recursive function has an exponential behaviour - that is what I was expecting. Though, I'm not completely sure about CPU time for the iterative version since that function does not look like this one (section log-log graphs).
I'd like to answer myself without doubts but I'm quite newbie.