help how to sort a list in order of 'n' in python without using inbuilt functions??
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Sat May 25 10:30:22 EDT 2013
On Fri, 24 May 2013 23:05:17 -0700, lokeshkoppaka wrote:
> On Saturday, May 25, 2013 11:27:38 AM UTC+5:30, Steven D'Aprano wrote:
>> tally = 0
>> for item in list_of_items:
>> if item == 0:
>> tally = tally + 1
>>
>> print "The number of zeroes equals", tally
>
>
> ya steven i had done the similar logic but thats not satisfying my
> professor he had given the following constrains
> 1. No in-built functions should be used
The above does not use any built-in functions.
> 2. we are expecting a O(n) solution
The above is O(n).
> 3. Don't use count method
The above does not use the count method.
--
Steven
More information about the Python-list
mailing list