Introduction of Analysis Design & Algorithm

42

Transcript of Introduction of Analysis Design & Algorithm

Page 1: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 1/42

Page 2: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 2/42

COURSE OBJECTIVE

Upon completion of this course, students will be able to do the

following:

1.Analyze the asymptotic performance of algorithms.

2.Demonstrate a familiarity with major algorithms and data

structures.

.Apply important algorithmic design paradigms and methods of

analysis.

!."ynthesize efficient algorithms in common engineering designsituations.

Page 3: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 3/42

What is Algorithm?

Algorithm

1.is any well#defined computational procedure that ta$es some

%alue, or set of %alues, as input and produces some %alue, or set of

%alues, as output.

2.is thus a se&uence of computational steps that transform the

input into the output.

.is a tool for sol%ing a well # specified computational problem.

!.Any special method of sol%ing a certain $ind of problem '(ebsterDictionary)

Page 4: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 4/42

What is a program?

• A program is the e*pression of an algorithm in aprogramming language

• a set of instructions which the computer will follow to

sol%e a problem

Page 5: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 5/42

Methods in Analysis esign Algo!

+earn general approaches to algorithm design

1. Di%ide and con&uer

2. reedy method

. Dynamic -rogramming!. ac$trac$ing

/. ranch 0 ound

.-arallel Algorithm

. asic "earch and 3ra%ersal 3echni&ue

Page 6: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 6/42

Some Appli"ation

"tudy problems these techni&ues can be applied to

• "orting

• Data retrie%al

• 4etwor$ routing

• ames

• 5tc

Page 7: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 7/42

Why do #e analy$e a%o&t them?

• understand their beha%ior, and '6ob ## "election,performance, modify)

• impro%e them. '7esearch)

Page 8: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 8/42

What do #e analy$e a%o&t them?

• 8orrectness

• Amount of wor$ done

• Amount of space used

• "implicity, clarity

• 9ptimality

Page 9: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 9/42

Comple'ity

3he comple*ity of an algorithm is simply the amount of

 wor$ the algorithm performs to complete its tas$.

Page 10: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 10/42

(! i)ide and Con*&er

1.   Di%ide to sub#problems

2.  "ol%e the sub#problems

.  8on&uer the solutions

Page 11: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 11/42

• inary "earch

• erge "ort

• ;uic$ "ort

Topi"s Co)ered in i)ide and Con*&er

Te"hni*&e

Page 12: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 12/42

• inary "earch

Page 13: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 13/42

• erge "ort

Page 14: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 14/42

• ;uic$ "ort

Page 15: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 15/42

+! ,reedy Method -or Optimi$ation

.ro%lems5%ery two#year#old $nows the greedy algorithm.

<n order to get what you want, just start grabbing what loo$s best.

"urprisingly, many important and practical optimization problems

can be sol%ed this way.

Page 16: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 16/42

• 9ptimal erge -attern

• inimum "panning 3ree

• =napsac$ -roblem

• 6ob "e&uencing with Deadlines

• "hortest -ath Algorithm

Topi"s Co)ered in ,reedy Strategy

Page 17: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 17/42

• 9ptimal erge -attern

Page 18: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 18/42

• inimum "panning 3ree

Page 19: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 19/42

• =napsac$ -roblem

Page 20: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 20/42

• 6ob "e&uencing with Deadlines

Page 21: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 21/42

• "hortest -ath Algorithm

Page 22: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 22/42

/! ynami" .rogramming

Dynamic programming sol%es optimization problems bycombining solutions to sub problems

3he $ey is to store the solutions of sub problems to be

 reused in the future

>ig:# >inding the shortest path in a graph using optimal substructure? a straight line

indicates a single edge? a wa%y line indicates a shortest path between the two

%ertices it connects 'other nodes on these paths are not shown)? the bold line is the

o%erall shortest path from start to goal.

Page 23: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 23/42

• @1 =napsac$ -roblem

• ulti "tage raph

• 7eliability Design

• >loyd (arshall Algorithm

Topi"s Co)ered in ynami" .rogramming

Page 24: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 24/42

• @1 =napsac$ -roblem

Page 25: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 25/42

• ulti "tage raph

Page 26: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 26/42

• 7eliability DesignCost o- a System 01(23 3

Devices

D1 D2 D3

Cost 30 15 20

Reliability

0.9 0.8 0.5

Page 27: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 27/42

• >loyd (arshall Algorithm

Page 28: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 28/42

4! Ba"5tra"5ing

ac$trac$ing is the procedure whereby, after determining that a

node can lead to nothing but dead nodes, we go bac$ 'Bbac$trac$C)

to the nodes parent and proceed with the search on the ne*t child.

start ?

?

dead end

dead end

?

?

dead end

dead end

?

success!

dead end

Page 29: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 29/42

• E ;ueens -roblem

• Familtonian 8ycle

• raph 8oloring -roblem

Topi"s Co)ered in Ba"5tra"5ing

Page 30: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 30/42

• E ;ueens -roblem

Page 31: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 31/42

• Familtonian 8ycle

Page 32: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 32/42

• raph 8oloring -roblem

Page 33: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 33/42

3! Bran"h 6 Bo&nd• 3he branch#and#bound design strategy is %ery similar to

bac$trac$ing in that a state space tree is used to sol%e aproblem.

• An enhancement of bac$trac$ing

• Applicable to optimization problems

Page 34: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 34/42

• 3ra%eling "alesmen -roblem

Topi"s Co)ered in Bran"h 6 Bo&nd

Page 35: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 35/42

7! .arallel Algorithm• -arallel computing is a techni&ue in which gi%en problem is

subdi%ided into many sub problems, so that each processorcan wor$ on a sub problems? and solutions from all the

processors are collected together to form a final solution.

• 3he algorithm re&uired by multiple processors to sol%e the

sub problems simultaneously is called parallel algorithm

Page 36: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 36/42

8! Basi" Sear"h and Tra)ersal Te"hni*&e

• inary "earch 3ree• Feight balanced 3rees

• 2# 3rees

• 3rees• 3ree 3ra%ersal 3echni&ues

•  raph 3ra%ersal 3echni&ues

Page 37: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 37/42

• inary "earch 3ree

Page 38: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 38/42

• Feight balanced 3rees

Page 39: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 39/42

• 2# 3rees• 3rees

Page 40: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 40/42

• 3ree 3ra%ersal 3echni&ues

Page 41: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 41/42

• raph 3ra%ersal 3echni&ues  readth >irst "earch#11,12,1E,1,1!,1/,1,1

  Depth >irst "earch# 11,12,1!,1E,1/,1,1,1

Page 42: Introduction of Analysis Design & Algorithm

8/17/2019 Introduction of Analysis Design & Algorithm

http://slidepdf.com/reader/full/introduction-of-analysis-design-algorithm 42/42