Data Structures and Algorithms with Object-Oriented Design Patterns in C#
next up previous contents index

Projects

  1. Write a non-recursive method to compute the factorial of n according to Equation gif. Calculate the running time predicted by the detailed model given in Section gif and the simplified model given in Section gif.
  2. Write a non-recursive method to compute tex2html_wrap_inline57963 according to Equation gif. Calculate the running time predicted by the detailed model given in Section gif and the simplified model given in Section gif.
  3.   Write a program that determines the values of the timing parameters of the detailed model ( tex2html_wrap_inline57411, tex2html_wrap_inline57413, tex2html_wrap_inline57423, tex2html_wrap_inline57425, tex2html_wrap_inline57427, tex2html_wrap_inline57429, tex2html_wrap_inline57431, tex2html_wrap_inline57435, tex2html_wrap_inline57437, tex2html_wrap_inline57807, and tex2html_wrap_inline57471) for the machine on which it is run.
  4. Using the program written for Project gif, determine the timing parameters of the detailed model for your computer. Then, measure the actual running times of Programs gif, gif and gif and compare the measured results with those predicted by Equations gif, gif and gif (respectively).
  5. Given a sequence of n integers, tex2html_wrap_inline58233, and a small positive integer k, write an algorithm to compute

    displaymath58203

    without multiplication. Hint: Use Horner's rule and bitwise shifts.

  6. Verify Equation gif experimentally as follows: Generate a large number of random sequences of length n, tex2html_wrap_inline58239. For each sequence, test the hypothesis that the probability that tex2html_wrap_inline57623 is larger than all its predecessors in the sequence is tex2html_wrap_inline58243. (For a good source of random numbers, see Section gif).


next up previous contents index

Bruno Copyright © 2001 by Bruno R. Preiss, P.Eng. All rights reserved.