count + / return count to determine the run time of this functionwe have to determine the number of loop iterations just like we did with the earlier examples since the loop variable is cut in half each timethis will be less than for exampleif equals variable will contain the following five values during subsequent iterations ( given small numberit' easy to determine the number of loop iterations but how do we compute the number of iterations for any given value of nwhen the size of the input is reduced by half in each subsequent iterationthe number of iterations required to reach size of one will be equal to blog nc or the largest integer less than log nplus in our example of there are log or four iterations the logarithm to base of number nwhich is normally written as loga nis the power to which must be raised to equal nn ay thusfunction ex (requires (log ntime since many problems in computer science that repeatedly reduce the input size do so by halfit' not uncommon to use log to imply log when specifying the run time of an algorithm finallyconsider the following definition of function ex ()which calls ex (from within loop since the loop is executed times and function ex (requires logarithmic timeex (will have run time of ( log ndef ex )count for in rangen count +ex return count different cases some algorithms can have run times that are different orders of magnitude for different sets of inputs of the same size these algorithms can be evaluated for their bestworstand average cases algorithms that have different cases can typically be identified by the inclusion of an event-controlled loop or conditional statement consider the following examplewhich traverses list containing integer values to find the position of the first negative value note that for this problemthe input is the collection of values contained in the list def findnegintlist ) len(intlistfor in rangen if intlist[ return return none