CMSC 201

# Homework 1--Due 2/5

This homework must be submitted by 8pm on the due date to get any credit.

Homework one will consist of writing out simple algorithms in english, in order to allow you to practice thinking sequentially. Don't worry about computer language when you are writing: simply provide a list of steps. You should do this assignment on the server. Use emacs to create the file hw1.txt. This will be what you submit.

1. You are going to have to decide if a number is or isn't prime (A prime is a number that only evenly divisible by itself and one). What series of actions could you take to decide if a number is or isn't prime?
2. A palindrome is a word that is the same forward as it is backwards. For example, 'Anna' is a palindrome. Write down steps you could follow in order to decide if a word is or isn't a palindrome.
3. You have a list of a thousand numbers in front of you. Write down the exact steps you would take to find the highest number in this list.
4. You are at a shelf with a thousand books on it. You want to put them in alphabetical order, but the only thing you can do is swap the position of two books that are already next to each other. What steps could you follow in order to put the books in order?
5. You are given a number and must find the factorial of this number.

# Submitting

Note: We will cover how to do this in the first lab. If you have it done by then, you can submit it there.

When you've finished your homework, use the submit command to submit the file. You must be logged into your account and you must be in the same directory as the file you're trying to submit. At the Linux prompt, type

submit cs201 HW1 hw1.txt

After entering the submit command shown above, you should get a confirmation that submit worked correctly:

Submitting hw1.txt...OK

If not, check your spelling and that you have included each of the required parts and try again.

You can check your submission by entering:

submitls cs201 HW1

You should see the name of the file that you just submitted, in this case hw1.txt

 Adapted from UMBC CSHC's webpage design