CT240 lab1
http://geminga.it.nuigalway.ie/~gettrick/courses/CT240/labs/l1.html
-
For this lab you must submit a printout of all source code (python
files), and the result(s) of running the program on (a few)
test cases.
The source code must
be well presented (indenting, spaces, reasonable variable/function names,
etc.) and must include comments (as a rough guideline - aim to have nearly as
many comments as lines of code). Any questions asked should be answered on a plain sheet of paper.
-
The above material should be given to Paul or left in the cardboard box marked CT240 in the mail room (room IT415) on the 4th floor of the IT Building
before
the deadline of 5pm
Monday 22nd. September 2008. You will lose 20% for each day
(or part of day) the lab is late.
-
Plagiarism (the unattributed copying of work from other sources
(internet, fellow students,....)) will not be tolerated. Please see
http://www.nuigalway.ie/engineering/documents/plagiarism_guide_students
_v4.pdf. You risk getting zero for your lab if it is found to be
plagiarized.
-
You should first experiment with some of the programs for calculating
xy at
http://grobner.it.nuigalway.ie/python/.
-
Look specifically at the recursive program
http://grobner.it.nuigalway.ie/python/rec1.py.
From the description of binary powering, and the programs shown in lectures, write a python
program that calculates xy using
recursive binary powering.
-
Using your program, calculate
-
327
-
1.000000199999999
-
-1.000000156789
-
Would you expect your program to run quicker for 2511 or
21024? Calculate how many times the function in your
recursive program is called in each of these two cases.
©
NUI, Galway