CMPSCI 311: Theory of Algorithms

David Mix Barrington

Fall, 2003

Discussion Notes #4

from Wednesday 1 Oct 2003

Multiplying Large Integers (Levitin 4.5)

Please answer the questions during the discussion period.

Java provides a BigInteger class for storing integers too long for an int or long. Here we will look at the complexity of addition and multiplication of BigInteger objects, and determine whether the unusual multiplication algorithm of Levitin section 4.5 is useful in this context.

We'll assume that a (non-negative) BigInteger is written in the form "the sum for i from 0 to n of biri, where r is a base such as MAXINT+1. Each bi is kept in an int variable, and these int variables are kept in some sort of list. We can get bi from b, for example, in O(1) time by the call b.getTerm(i), and change bi to x in O(1) time by b.setTerm(i,x).

Last modified 2 October 2003