Groups
Sign in
Groups
Building Skills Books
Conversations
About
Send feedback
Help
GCD Exercise
51 views
Skip to first unread message
Michael Catanzaro
unread,
Jul 5, 2012, 9:00:20 PM
7/5/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to building-s...@googlegroups.com
There appears to be a problem with the GCD exercise in the chapter on functions:
http://www.itmaybeahack.com/book/python-2.6/html/p01/p01c09_functions.html#function-exercises
This algorithm is an infinite loop - trace with p=4, q=2 to see why.
From your iterative version, the third step should be: if p > q, return GCD(p-q, q)
Thanks for the free book. :-)
Reply all
Reply to author
Forward
0 new messages