h5 - March 17 HW5: Exponentiation Due April 2 Reading:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
March 17 HW5: Exponentiation Due April 2 This assignment studies numeric computations with big integers, both theoretically and in Perl. (We also cover Perl arrays.) The assignment is based on CLRS Problem 31-3 part c (p.903). Begin by solving that problem. Part A Download m add.pl and run it. This program illustrates a number of Perl features, that we’ll review in recitation. Notice that the output of m add.pl shows it uses linear time, as you’d guess. Modify m add.pl to do the following experiment: Loop num from 2000 to 64000, doubling each time. For each value of num , compute F n for n equal to num , in two di±erent ways. The ²rst way is the naive algorithm – it’s the standard way to compute Fibonacci’s, using the de²nition F n +2 = F n +1 + F n . The second way is your solution to the CLRS problem. Record the time for both computations. Print out a table of timings whose ²rst line will look like this:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

h5 - March 17 HW5: Exponentiation Due April 2 Reading:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online