Does inner loop counts as a step?
Author Message
g3xyz Offline
Student


Reputation: 0
Post: #1
Does inner loop counts as a step?
def IS(A)
i =1
while i <len(A):
>>t = A[i]
>>j = i
>>while j >0 and A[j-1] >t:
>>>> A[j] = A[j-1]
>>>> j = j-1
>>A[j] =t
>>i = i+1


Running time of inner loop: 3n+1
Is the:
Running time of outer loop: n (3n+1 + 6) + 1
or
n(3n+1 + 5) + 1 ?
(This post was last modified: 2013-12-12 13:10 by g3xyz.)
2013-12-12 13:07
Find all posts by this user Quote this message in a reply
Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5


Forum Jump:


User(s) browsing this thread: 1 Guest(s)