Big-O notation (was: Re: Python and Schools)
Anton Vredegoor
anton at vredegoor.doge.nl
Tue Apr 15 21:51:17 EDT 2003
Chad Netzer <cnetzer at mail.arc.nasa.gov> wrote:
>Also, one further class that is import to know is O( 2**N ), such as the
>brute-force solution to the "travelling salesman problem". These are
Although it's important to not set too severe limitations I have the
impression this salesman is underestimating the problem.
>>> def fac(n):
... return reduce(operator.mul,range(2,n+1),1)
...
>>> fac(10)
3628800
>>> 2**10
1024
Anton
More information about the Python-list
mailing list