[Chicago] Chicago Digest, Vol 29, Issue 6

Andrew Harrington aharrin at luc.edu
Mon Jan 7 01:01:21 CET 2008


Short and sweet in theory, but awful exponential run time!
Andy

Message: 8
> Date: Sun, 06 Jan 2008 02:33:43 -0600
> From: "Kenneth P. Stox" <ken at stox.org>
> Subject: Re: [Chicago] Python Tutorial 4.6 function fib()
> To: The Chicago Python Users Group <chicago at python.org>
> Message-ID: <1199608423.9450.24.camel at stox.dyndns.org>
> Content-Type: text/plain
>
> Welcome to the wonderful world of recursion:
>
> def fib(n):
>  if n<2:
>    return n
>  else:
>    return fib(n-2)+fib(n-1)
>
>
>
>
> ------------------------------
>
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago
>
>
> End of Chicago Digest, Vol 29, Issue 6
> **************************************
>



-- 
Andrew N. Harrington
 Director of Academic Programs
 Computer Science Department
 Loyola University Chicago
 512B Lewis Towers (office)
 Snail mail to Lewis Towers 416
 820 North Michigan Avenue
 Chicago, Illinois 60611

http://www.cs.luc.edu/~anh
Phone: 312-915-7999
Fax:    312-915-7998
gdp at cs.luc.edu for graduate administration
upd at cs.luc.edu for undergrad administration
aharrin at luc.edu as professor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/chicago/attachments/20080106/a56dd70b/attachment.htm 


More information about the Chicago mailing list