Re: [Tutor] stable algorithm

2008-12-14 Thread Alan Gauld
"spir" wrote And how can i write single test which will tell me execution time of this algorithm? First, google will give you tons of links on the topic. time.time() returns present time in ms You could also use the python profiler which will give you timing information for just the sort f

Re: [Tutor] stable algorithm

2008-12-14 Thread spir
David Hláčik a écrit : Hi, thank you very much. And how can i write single test which will tell me execution time of this algorithm? I need to write a table with number of data & execution time comparison (and it should be linear in case of this algorithm) Thanks! D. First, google will giv

Re: [Tutor] stable algorithm

2008-12-14 Thread David Hláčik
Hi, thank you very much. And how can i write single test which will tell me execution time of this algorithm? I need to write a table with number of data & execution time comparison (and it should be linear in case of this algorithm) Thanks! D. On Sun, Dec 14, 2008 at 5:58 PM, Alan Gauld wro

Re: [Tutor] stable algorithm

2008-12-14 Thread Alan Gauld
"David Hlácik" wrote yes it is homework , this is result : #! /usr/bin/python def sort(numbers): "sort n positive integers in O(n) provided that they are all < n^2" N = len(numbers) # get size of test numbers buckets_mod = [[] for i in xrange(N)] buckets_sorted =

Re: [Tutor] stable algorithm

2008-12-14 Thread David Hláčik
> def sort(numbers): >"sort n positive integers in O(n) provided that they are all < n^2" Sorry about wrong comment, should be range from [1 to n^2] not only < n^2. D. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listin

Re: [Tutor] stable algorithm

2008-12-14 Thread David Hláčik
> > Does that mean its homework? > Hi, yes it is homework , this is result : #! /usr/bin/python def sort(numbers): "sort n positive integers in O(n) provided that they are all < n^2" N = len(numbers) # get size of test numbers buckets_mod = [[] for i in xrange(N)]

Re: [Tutor] stable algorithm

2008-12-14 Thread Alan Gauld
"David Hlácik" wrote this is for me life important problem which needs to be solved within next 12 hours.. Does that mean its homework? If so we can only offer pointers, but you need to tell us what you have done yourself first. If its not homework then please give a bit more background. W

[Tutor] stable algorithm

2008-12-14 Thread David Hláčik
Hi guys, i am really sorry for making offtopic, hope you will not kill me, but this is for me life important problem which needs to be solved within next 12 hours.. I have to create stable algorithm for sorting n numbers from interval [1,n^2] with time complexity O(n) . Can someone please give m