CT240 lab1


http://geminga.it.nuigalway.ie/~gettrick/courses/CT240/labs/l1.html




  1. You should first experiment with some of the programs for calculating xy at http://grobner.it.nuigalway.ie/python/.
  2. 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.
  3. Using your program, calculate
    • 327
    • 1.000000199999999
    • -1.000000156789
  4. 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