next up previous
Next: About this document Up: My Home Page

Midterm 2

Monday, November 11 we will have the second midterm. It will mostly cover material since the first midterm, primarily on operating systems, spreadsheets, the internet, and programming.

The test will be similar in format to the first midterm, with true/false, multiple choice, and some short answer.

There will be a small number of true/false and multiple choice questions taken from the first midterm, so it will pay to review the midterm and see that you understand the previous material.

For next class, I will prepare a study guide to help with your preparation, but you should read the chapters and the lecture notes as well.

Pizza with the Prof, Wednesday, November 13, 6PM. Email reservations will be accepted!

Computer Programming

A computer program consists of a detailed sequence of instructions which accomplish a given application or task.

Building computer software is a complicated process, including developing specifications, designing the software, programming or coding, testing and documentation.

Large programs are designed by decomposing the task into a set of of subproblems, and writing a module for each subproblem.

Prior to writing the software in a programming language, the sequence of steps (algorithm) to be performed have to be clarified by writing them as a flowchart or in pseudocode.

In any complicated applications, there are an enormous number of possible ways a program can be used. Therefore it is very difficult to produce software which is always correct.

Testing is thus an important part of the design process. The Microsoft Excel group has one full-time tester for each full time programmer!

Good documentation is critical to producing software which is usable by ordinary people, as well as able to be understandable to future developers. A large number of non-computer science people are employed as technical writers because of their ability to communicate clearly.

Algorithms

An algorithm is a procedure for solving a well-defined problem.

A recipe is an algorithm for making a particular type of food.

A program is an algorithm specified in such detail that a computer knows exactly how to follow it.

When designing any algorithm, we have two different criteria for success. An algorithm must be correct, meaning it solves the problem exactly. Further it must be efficient, meaning that it solve the problem using a reasonable amount of computer time.

Does anyone have an algorithm they use to solve the problem of playing ``20 Questions''?

Twenty Questions

1.

2.

3.

4.

5.

6.

7.

8.

9.

10.

11.

12.

13.

14.

15.

16.

17.

18.

19.

20.

Sorting

Sorting is one of the most important operations which is performed on computers. Supposedly computers spend 25% of their time sorting.

There are many different reasons why we want to sort:

Why are telephone books sorted? Because it permits very fast lookup using the binary search algorithm.

How can we eliminate duplicates in a list of names? (Steve, Fred, Mike, Steve, Mary, Yaw-Ling, Mike, Tonya) We can sort the names in alphabetical order - all duplicates will be next to each other.

How can we order things according to importance? To identify who the richest people are, just sort them according to income. Thus spreadsheets have sorting function built in. Maybe this can help you identify the 10 best players in Project 3? (HINT)

Sorting Algorithms

But what kind of algorithms can we use to sort things?

One idea would be to put the items into different piles based on the first letter or digit, and then sort each pile. This is called bin sort.

Another idea would be to start with a single item as a ``sorted'' list, and then repeatedly take a new item and insert it into its proper position in the sorted list. This is called insertion sort.

Yet another idea would be to start with all the unsorted items, scan through them, and find the one which should be first. Take it out, and repeat with the item which should be second, etc. This is called selection sort.

Yet another idea would split the unsorted pile into two equal-sized piles, sort each of the piles, and then merge them back together. This algorithm is called merge sort.

Comparing Algorithms

Which of these algorithms is best? Evaluating the efficiency of algorithms can be done by mathematical analysis or comparing the speeds of programs.

Perhaps we can do our own comparison of different sorting algorithms?

Does having more than one worker speed the job up?

Note that the difference between sorting in increasing or decreasing order does not require a different algorithm, just a different answer when we ask ``does A go before B?''.




next up previous
Next: About this document Up: My Home Page

Steve Skiena
Mon Nov 4 14:48:15 EST 1996