Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword
Like this
31Activity
0 of .
Results for:
No results containing your search query
P. 1
Design and Analysis of Algorithms

Design and Analysis of Algorithms

Ratings: (0)|Views: 393|Likes:
Published by microcomputer

More info:

Published by: microcomputer on Mar 12, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

11/19/2012

pdf

text

original

 
 Design and Analysis of AlgorithmsChapter 1
Design and Analysis of Algorithms -Chapter 11
 Algorithm Algorithm
AnAn
algorithmalgorithm
is a sequence of unambiguousis a sequence of unambiguousinstructions for solving a problem, i.e., forinstructions for solving a problem, i.e., forobtaining a required output for any legitimateobtaining a required output for any legitimateinput in a finite amount of time.input in a finite amount of time.
 
Design and Analysis of Algorithms -Chapter 12
Historical PerspectiveHistorical Perspective
Euclid’s algorithm for finding the greatest common divisorEuclid’s algorithm for finding the greatest common divisor
MuhammadMuhammadibnibnMusaMusaalal--KhwarizmiKhwarizmi –  – 99
thth
centurycenturymathematicianmathematicianwww.lib.virginia.edu/science/parshall/khwariz.htmlwww.lib.virginia.edu/science/parshall/khwariz.html
 
Design and Analysis of Algorithms -Chapter 13
Notion of algorithmNotion of algorithm
“computer”Algorithmic solution problemalgorithminput output
Design and Analysis of Algorithms -Chapter 14
Example of computational problem: sortingExample of computational problem: sorting
Statement of problem:Statement of problem:
 Input: Input:
A sequence of A sequence of 
nn
numbers <anumbers <a
11
,,aa
22
, …, a, …, a
nn
>>
Output:Output:
A reordering of the input sequence <aA reordering of the input sequence <a
´´11
,,aa
´´22
, …,, …,aa
´´
nn
>>so thatso thataa
´´
aa
´´
 j  j 
wheneverwhenever
<<
 j  j 
Instance: The sequence <5, 3, 2, 8, 3>Instance: The sequence <5, 3, 2, 8, 3>
Algorithms:Algorithms:
Selection sortSelection sort
Insertion sortInsertion sort
Merge sortMerge sort
(many others)(many others)
Design and Analysis of Algorithms -Chapter 15
Selection SortSelection Sort
Input: arrayInput: array
a[1],…,[1],…,a[n[n]
Output: arrayOutput: array
a
sorted in nonsorted in non--decreasing orderdecreasing order
Algorithm:Algorithm:for
i
=1 to
n
swap
a[
i
]
with smallest of 
a[i],…a[
n
]
• see also pseudocode, section 3.1
Design and Analysis of Algorithms -Chapter 16
Some WellSome Well--known Computational Problemsknown Computational Problems
SortingSorting
SearchingSearching
Shortest paths in a graphShortest paths in a graph
Minimum spanning treeMinimum spanning tree
PrimalityPrimalitytestingtesting
Traveling salesman problemTraveling salesman problem
Knapsack problemKnapsack problem
ChessChess
Towers of HanoiTowers of Hanoi
Program terminationProgram termination

Activity (31)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Junalyn Pangayan liked this
Sunil Chowdhary liked this
Chandra Sekhar liked this
Rimpz ╰❥ liked this
prac87 liked this
puppalauday liked this
indiraramisetty liked this
Ankit Kharkwal liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->