600.102: Foundations of Computer Science

Fall Semester 2005: September 8, 2005 - December 12, 2005

Assignment 1: Warmup

Out on: September 12, 2005
Due by: September 18, 2005 by 5:59 pm for full credit (11:59 pm for 10% off, hard deadline)
Collaboration: None

Overview

The first assignment for 600.102: Foundations of Computer Science covers material from Week 1 and the corresponding reading.

Problem 1: Boxes of Problems

Assume you have an infinite supply of the "boxes" we used in lecture for numeric computations: constants, addition, multiplication, and square root. Now consider the following:

  1. Define each of the "boxes" in this list: twice which doubles its input, square which squares its input, and inc which increments its input by one. Try to use the minimum number of "basic boxes" from above.
  2. Define a "box" that evaluates a polynomial p of the form a*x*x + b*x + c; all four of these are inputs. How many "basic boxes" do you need?
  3. If you could get the polynomial in a different form, could you get away with three "basic boxes"? Why or why not?

Problem 2: Unix

Describe how you can determine the number of directories (not files, only directories) in a given directory by using the ls, grep, and wc commands only. The commands should be connected through a pipe which is written as | in the Unix shell.

Problem 3: Multiplication

In lecture we discussed in some detail how to add two binary numbers in twos-complement representation. For this problem you need to give a description of how to multiply two numbers in twos-complement representation. The level of detail should be similar to what we did in lecture. You can use the "standard" method for doing multiplication of decimal numbers with suitable adaptation to binary numbers. Note that multiplication can involve addition as a step, but the number of additions should be given by the length of the binary numbers, not by the value they represent. Try to be as exact as possible, try to not forget a step anywhere.

You should include an example as well, but the process you describe should be generic and work for any two binary numbers.

Problem 4: And you?

Finally, please summarize briefly why you are taking this course and what topics (or kinds of topics) would be of interest to you. Thanks! :-)

Deliverables

Please turn in a simple Unix text file (not M$ Word, not PDF, just plain ASCII text) with your answers. It should be formatted in a decent way of course, and it should contain your contact information. The file name should be cs102-assignment-1-login with login replaced by your Unix login name (so I would use cs102-assignment-1-phf).

Bonus Problem

If you really want to impress us, try the following. From the IRS website: "Filing Late and/or Paying Late: Information You Should Know" What exactly is the meaning of the connective "and/or"? Do you think that using "and/or" is good writing style? Is it logical? Note that we won't give you extra points for this, but we'll give you extra kudos. :-)

Updated: $Id: assignment-1.html 30 2005-09-13 23:09:44Z phf $ Validate: XHTML CSS
Copyright © 2005 Peter H. Fröhlich. All rights reserved.