CS350 Project 1

This document defines project number 1 of CS350.

Objective

The goal of this project is to implement an algorithm presented in the course and to apply notions introduced by the course to this program/algorithm. The assignment is relatively open-ended. The instructor will answer any question you may have. However, when in doubt, work toward the project goal stated above. This is an individual project. You may discuss it with other students, but the work you present must be your own only.

Deliverable

You will produce two items: (1) the code of the program specified below, and (2) a narrative of your work specified below. You will e-mail both items to the TA (whose address will become available in the syllabus early in the course). The items will be transmitted as attachments to your e-mail. The code will be formatted as ASCII text. The narrative will be formatted as either ASCII text or PDF. The deadline follows the rules of the homework, the beginning of the first lecture of the week following the assignment, except that you will e-mail the material rather than bringing a hard copy to class. Late submission will be accepted up to 3 days and will be penalized at 10% a day.

Code spec

Your code will implement Karatsuba's algorithm for the multiplication of large integers without any optimization. Your program is expected to read a file called "input-1.txt" containing 2*k lines, li and mi, for i in 1,2,... k. Each line contains a non-negative integer in the range of about 300-350 digits. No other characters beside digits are in each line. Integers are written in the usual notation, in particular there are no leading zeros. An example of input file is input-1.txt. Your program is expected to write a file called "output-1.txt" containing 3*k lines, li, mi and ni, for i in 1,2,... k, where ni=li*mi. An example of output file is output-1.txt. The format of the output is the same as the format of the input file, except for the range of the products.

The programming language can be any of Java, Python, Ruby, C, and C++. Deliver all your code in a single file that can be compiled and executed on cs.pdx.edu. Consult the instructor if you have compelling reasons to do otherwise. Probably, you will store a large integer in an array, one decimal digit per entry. You should assume that each array entry is no more than 8 bits wide, even if your language allows wider entries. If you choose differently explain in your narrative where and why this is convenient. Your program should perform reasonably efficiently both in theory and in practice.

Narrative spec

The narrative is intended to show that you know and understand the aspects of the project related to this course, in particular, ability to: (1) implement an algorithms, (2) relate theoretical complexity to practice, (3) code correct, readable and efficient programs, and (4) communicate your work clearly and concisely.

I would expect to find one or more of the following: (1) a description of key data structures and algorithms used in the program, (2) the running time analysis of your algorithm/program, (3) a description of correctness including limitations, invariants, and/or conventions, and (4) any benchmarking, profiling and/or testing employed for development.

Hints

You are encouraged to start your work early. Since you are not expected to know Karatsuba's algorithm, the initial version of your project can use the multiplication algorithm that you learned in grade school. This approach has many benefits, including an early start and the opportunity to compare both execution time and operation count of the two versions, which give further insight on the material presented in the course.