This page lists a number of elementary problems that are good examples of the kinds of problems that can be studied from the point of view of an algorithms course. Each one of these problems can be solved by one or more algorithms which can be implemented as Java or C++ programs. Notice how the problems on this page are in a certain way analogous to classes in object oriented programming. Each problem below is really a description of a whole family of problems, just as a class is a description of a whole family of objects. Each problem below can be "instantiated" as a specific problem with specific numbers in a specific list (much as objects are specific instances of a class). We say that an algorithm solves a problem if the algorithm finds the correct solution for every instance of the problem. Given one of these problems and given a specific algorithm that solves it, the key issue for us is how the "run time" of the algorithm, when it is applied to an instance of the problem, depends on the "size" of the problem instance. For example, if you double the length of an input list, does the algorithm's run time double (an O(n) algorithm), or does it quadruple (an O(n^2) algorithm), or maybe the run time goes up by just a very small amount (an O(ln(n)) algorithm). One important thing to realize is that a specific problem can have different algorithms with different run time behaviors, i.e., one algorithm that solve the problem is O(n) but another algorithm that also solves the problem is O(ln(n)).
|
|||||