[WPI] [cs2223] [cs2223 text] [News] [Syllabus] [Classes]
Welcome to cs2223.
This website will be a major source of information throughout the course. Please look over everything in this web site and be sure to read the Course web page, which contains important information about the course - including grading information and the course groundrules.
Note the reading assignment on the Syllabus page. Scan all of Chapter 1, which is a review of the mathematics used in analyzing algorithms. Make a list of which topics you don't feel comfortable with so that you can refer to it throughout the course. We will identify the mathematical topics as we use them and your list will help you to decide when to pay close attention, or when to work additional problems, or when to seek extra help in help sessions or class.
This course is about algorithms, a sequence of computer instructions which solve a computational task. We will study two imporatant aspects of algorithms. First, how can we analyze algorithms to make sure we have selected ones which are best suited to meeting our needs. Second, how can we write and test the algorithms we have selected. Most programmers focus on the second of these aspects, but computer scientists are also concerned with the first. That is because algorithms which produce equivalent results can vary drastically in the amounts of time or storage space they use. We will be developing the tools to evaluate and understand algorithms, and we will show the conceptual framework within which computer scientists develop and analyize algorithms.
Alogrithms are often communicated by means of programs. Our textbook uses programs written in Pascal and some textbooks use pseudocode, but all of our class examples will be written in C++. Source code and script files will be available so that you can evaluate, test, and extend the code yourself. It is useful to develop the habit of combining testing with analysis as you analyze and use algorithms.
This is an algorithm for finding the minimum value in an array of ints
.
int min = INT_MAX; for (int i = 0; i < n; i++) if (array[i] < min) min = array[i];
We are interested in the computational complexity of this algorithm,
which is related to the number of operations which the computer must perform.
For example, the only addition in the problem (apart from calculating the
offset in accessing the array elements) is the increment of i. That
occurs once at the end of each iteration, so n additions are performed.
Similarly, this algorithm requires 2n comparisons. The number of replacements,
however, is not fixed. The replacement part of the i++ is performed n
times, but the replacement of min
can occur between 1 and n
times, depending on the exact nature of the data. The best case (least number
of replacements) occurs when the first element in the array is also the
smallest. The worst case (most replacements) occurs when the last element
is the smallest. The average case is somewhere between the two extremes
- probably around 1.5n replacements.
When designing and analyzing algorithms, it is always useful to consider the best, worst, and average cases.
[cs2223 text] [News] [Syllabus] [Classes] |