Beruflich Dokumente
Kultur Dokumente
3 10 9
lg(3 10
Merge 9sort: running
9
)instruc time nlgn
3 lg(3 109 )seconds 94.45seconds
10 instruc/s
1
What are algorithms?
2
Origin of the word:-Algorithm
• The word algorithm comes from the name of the
9th century Persian mathematician
Abu Abdullah Muhammad ibn Musa al-Khwarizmi
whose works introduced Indian numerals and
algebraic concepts.
• He worked in Baghdad at the time when it was the
centre of scientific studies and trade.
• The word algorism originally referred only to
the rules of performing arithmetic using
Arabic numerals but evolved via European
Latin translation of al-Khwarizmi's name into
algorithm by the 18th century.
• The word evolved to include all definite
procedures for solving problems or
performing tasks.
1.1 What are algorithms?
Algorithm
a well-defined computational procedure
that takes some value, or a set of values, as
input and produces some value, or a set of
values, as output
Algorithm
sequence of computational steps that
transform the input into the output.
1.1 What are algorithms
problem
algorithm
Algorithmic solution
1.1 What are algorithms
Computational
Input Output
Procedure
algorithm
Problem ? instance
general questiones (input) ?
needed to be computed input1 ?
input2 ?
input3 ? output
……
Algorithm
(a tool)
9
1.1 What are algorithms
uestiones (input) ?
be computed An instance of the sorting problem
input1 ?
Input: <31,41,59,26,41,58>
input2 ?
input3 ? Output: <26,31,41,41,58,59>
output
……
lgorithm
10
1.1 What are algorithms
11
Important Features
Finiteness:- If we trace out the instructions of an algorithm, then
for all cases, the algorithm terminates after a finite
number of steps.
Definiteness: Each instruction is clear and unambiguous, it must
be perfectly clear what should be done.
Input:- Zero or more quantities are externally supplied.
Output:- At least one quantity is produced
Effectiveness: Every instructions must be very basic so that it can
be carried out, in principle, by a person using only
pencil and paper in a finite amount of time.
Performing arithmetic on integers is an example of
an effective operation but arithmetic with real
numbers is not since some values may be
expressible only by infinitely long decimal
numbers.
1.1.1 What kinds of problems are solved by algorithms
Genome Project
Internet
finding good routes; search engine
Electronic commerce
keeping information; digital signatures
Manufacturing and other commercial settings
placing wells; buying campaign advertising
Theory value
14
What kinds of problems are solved by
algorithms?
• Biological Problems
• To manage and manipulate large volume of data over
Internet
• Problems based on numerical algorithms and number
theory (e.g Public-key cryptography and digital signature)
• Problems of linear programming, Dynamic programming,
Shortest Path Problems , Strings Matching Problems,
Matrix Problems etc.
1.1.2 Data structures
16
1.1.3 Technique
17
1.1.4 Hard problems
18
1.2 Algorithms as a technology
19
1.2.1 Efficiency
20
1.2.1 Efficiency
Algorithm B gains much more from the faster computer than A !!!
21
1.2.2 Algorithms and other technologies
22
1.2.2 Algorithms and other technologies
For example
a web-based service that determines how to travel
from one location to another
The implementation would rely on fast hardware, a
GUI, wide-area networking, and also possibly on OO
23
1.2.2 Algorithms and other technologies
24
1.2.2 Algorithms and other technologies
25
1.2.2 Algorithms and other technologies
26
What is Pseudocode?