1.3- problem types Flashcards
sorting problem
to rearrange the items of a given list in nondecreasing
order. Of course, for this problem to be meaningful, the nature of the list items
must allow such an ordering. (Mathematicians would say that there must exist
a relation of total ordering.) As a practical matter, we usually need to sort lists
of numbers, characters from an alphabet, character strings, and, most important,
records similar to those maintained by schools about their students, libraries about
their holdings, and companies about their employees.
Sorting:
key
In the case of records, we
need to choose a piece of information to guide sorting.
Such a specially chosen piece of information is called a key. Computer scientists often talk about sorting a list of keys even when the list’s
items are not records but, say, just integers
A sorting algorithm is called ______ if it preserves the relative order of any two equal elements in
its input.
stable
The second notable feature of a sorting algorithm is the amount of extra
memory the algorithm requires. An algorithm is said to be _______ if it does
not require extra memory, except, possibly, for a few memory units. There are
important sorting algorithms that are in-place and those that are not
in-place
deals with finding a given value, called a search key, in a given set (or a multiset, which permits several elements to have the same value).
searching problem
string
a sequence of characters from an alphabet.
Strings of particular interest are text strings, which comprise letters, numbers, and
special characters; bit strings, which comprise zeros and ones; and gene sequences,
which can be modeled by strings of characters from the four-character alphabet {A,
C, G, T}
One particular problem—that of searching for a given word in a text—has
attracted special attention from researchers. They call it _____ ______. Several
algorithms that exploit the special nature of this type of searching have been
invented.
string matching
can be thought of as a collection of points called vertices, some
of which are connected by line segments called edges.
graph
the problem of finding the shortest tour
through n cities that visits every city exactly once. In addition to obvious applications involving route planning, it arises in such modern applications as circuit
board and VLSI chip fabrication, X-ray crystallography, and genetic engineering.
traveling salesman problem (TSP)
seeks to assign the smallest number of colors to
the vertices of a graph so that no two adjacent vertices are the same color. This
problem arises in several applications, such as event scheduling: if the events are
represented by vertices that are connected by an edge if and only if the corresponding events cannot be scheduled at the same time, a solution to the graph-coloring
problem yields an optimal schedule.
graph-coloring problem
From a more abstract perspective, the traveling salesman problem and the graph coloring problem are examples of ______ _____. These are problems
that ask, explicitly or implicitly, to find a combinatorial object—such as a permutation, a combination, or a subset—that satisfies certain constraints. A desired
combinatorial object may also be required to have some additional property such
as a maximum value or a minimum cost.
combinatorial problems
Generally speaking, combinatorial problems are the most difficult problems in
computing, from both a theoretical and practical standpoint. Their difficulty stems
from the following facts. First, the number of combinatorial objects typically grows
extremely fast with a problem’s size, reaching unimaginable magnitudes even
for moderate-sized instances.
Second, there are no known algorithms for solving
most such problems exactly in an acceptable amount of time. Moreover, most
computer scientists believe that such algorithms do not exist. This conjecture has
been neither proved nor disproved, and it remains the most important unresolved
issue in theoretical computer science
deal with geometric objects such as points, lines, and polygons.
geometric algorithms
closest-pair problem
given n points in the plane, find the closest pair among them.
convex-hull problem
asks to find the smallest convex polygon that
would include all the points of a given set. If you are interested in other geometric
algorithms, you will find a wealth of material in such specialized monographs as
[deB10], [ORo98], and [Pre85].