Академический Документы
Профессиональный Документы
Культура Документы
The non-ambiguity requirement for each step of an algorithm cannot be com- promised.
The range of inputs for which an algorithm works has to be specified carefully.
There may exist several algorithms for solving the same problem.
Algorithms for the same problem can be based on very different ideas and can solve the
problem with dramatically different speeds.
gcd(60,0) = 60,
gcd(0,0) = ?
24 = 2 . 2 . 2 . 3
________________
Sorting
o Key, numeric or alphabetical
o Stable and in-place algorithms
o Best Algorithm is using n log2 n comparisons
Searching
o Search Key
String Processing
o String matching
Graph Problems
o Traveling Salesman Problem (TSP), Graph-Colouring Problem
o Applications: transportation, communication, social and economic
networks, project scheduling, and games
Combinatorial Problems
o Grow fast with problem size.
o No known algorithms as believe, with no proof.
o The shortest-path problem is an exception combinatorial problem
with known algorithms.
Geometric Problems
o Points, Lines, and Polygons.
o Applications: Computer Graphics, Robotics, and Tomography.
o Problems: closest-pair, convex-hull
Numerical Problems
o Mathematical objects of continuous nature: solving equations and
systems of equations, computing definite integrals, evaluating
functions, etc.
o Approximation because of real numbers causing an accumulation of
round-off error.
o Applications domains: Scientific and Engineering applications, and
now business applications.
--------------------------------------------------------------------------------------------
making this unnecessary). Other applications might require string matching algorithms as part of a
more complex algorithm (e.g., the Unix program ``diff'' that works out the differences between two
simiar text files). Sometimes we might want to search in binary strings (ie, sequences of 0s and 1s).
For example the ``pbm'' graphics format is based on sequences of 1s and 0s. We could express a task
like ``find a wide white stripe in the image'' as a string searching problem.
Graph problems:
Graph algorithms are one of the oldest classes of algorithms and they have
been studied for almost 300 years (in 1736 Leonard Euler formulated one of the first graph
problems Knigsberg Bridge Problem)
There are two large classes of graphs:
directed graphs (digraphs )
undirected graphs
Some algorithms differ by the class. Moreover the set of problems for digraphs and undirected
graphs are different. There are special cases of digraphs and graphs that have their own sets
of problem. One example for digraphs will be program graphs. Program graphs are important
in compiler construction and were studied in detail after the invention of the computers.
Graphs are made up of vertices and edges. The simplest property of a vertex is its degree, the
number of edges incident upon it. The sum of the vertex degrees in any undirected graph is
twice the number of edges, since every edge contributes one to the degree of both adjacent
vertices. Trees are undirected graphs which contain no cycles. Vertex degrees are important in
the reachability property. A minimum spanning tree is the smallest such tree. (Prim's
and Kruskal's algorithms)
Combinatorial problems:
From a more abstract perspective ,the traveling Salesman problem
and the graph coloring problems of combinatorial problems are problems that a task to find a
combinatorial object-such as a permutation a combination ,or a subset-that satisfies certain
constraints and has some desired property.Generally speaking, combinatorial problems are the
most difficult problems in computing ,from both the theoretical and practical standpoints.
Their difficulty stems from the following facts. First ,the number of combinatorial objects
typically grows extremely fast with a problem size , reaching unimaginable magnitudes even
moderate-sized intances. Second, there are no known algorithms for solving most such problems
exactly in an acceptable amount of time. Moreover, most computer scientist believe
such algorithms do not exist. This conjecture has been neither proved nor disproved ,and it
remains the most important resolved issue in theoretical computer science.
Some combinatorial problems can be solved by efficient algorithms, but they should be
considered fortunate to the rule. The shortest-problem mentioned earlier is among such exceptions.
Geometric Problems
Geometric algorithms deal with geometric objects such as points , lines, and polygons. Ancient
Greeks were very much interested in developing procedures for solving a variety of
geometric problems including problems of constructing simple geometric shapes-triangles
,circles and so on-with an unmarked ruler and a compass. Then ,for about2000 years ,intense
interest in geometrics disappeared, to be resurrected in the age of computers-no more rulers
and compasses, just bits, bytes, and good old human ingenuity. Of course, today people are
interested in geometric algorithms with quite different applications in mind, such as computer
Graphics, robotics, and tomography.
We will discuss algorithms for only two classic problems of computational geometry: the
closest pair problem and the convex-hull problem. The closest-pair problem is self explanatory
:given n points in the plain, find the closest pair among them. The convex hull problem is
to find the smallest convex polygon that would include all points of a given set.
Numerical Problems
Numerical problems, another large area of applications are problems that involve mathematical
objects of continuous nature: solving equations and system of equation, computing definite
integrals, evaluating functions and so on. The majority of such mathematical problems can be
solved only approximately. Another principal difficulty stems from the fact that such problem
typically requires manipulating real numbers, which can be represented in computer only
approximately.
Moreover, a large number of arithmetic operations performed on approximately
represented numbers can lead to an accumulation of the round-off error to a point where it can
drastically distort an output produced by a seemingly sound algorithm.
Many sophisticated algorithms have been developed over the years in this area ,and they continue
to play a critical role in many scientific and engineering applications. But in the last
25years or so, the computing industry has shifted its focus into business application .These
new application require primary algorithms for information storage, retrieval ,transportation
through networks and presentation to users. As a result of this revolutionary change, numerical
analysis has lost formerly dominating position in both industry and computer science programs.
Still, it is important for any computer-literate person to have at least a rudimentary idea
about numerical algorithms.
Fundamentals of Algorithmic problem solving
i. Understanding the problem
ii. Ascertain the capabilities of the computational device iii. Exact /approximate soln. iv. Decide on the
appropriate data structure v. Algorithm design techniques vi. Methods of specifying an algorithm vii.
Proving an algorithms correctness Analysing an algorithm