Processing math: 100%

Homework Assignment 3

  1. Page 153 describe the problem of peasant multiplication.
    1. Write a recursive algorithm for the multiplication operation mult(n, m).
    2. Write an iterative (non-recursive) algorithm. You will likely need a third variable to keep track of the sum and how it changes every time an odd n is encountered.
  2. Exercise 5.1.5 from page 175.
  3. Place the letters of word ALGORITHM in a search tree (insert them one at a time, don’t try to balance it). Then write out the order of vertices for each of the three traversals (in-order, pre-order, post-order).