Algorithm and Problem Solving - Lecture - Programing Fudamentals, Lecture notes of Programming Languages

Detail Summery about Programming Fundamentals, Algorithm and Problem Solving, Representation of Algorithms, Algorithm in natural language, Algorithm in Flowchart.

Typology: Lecture notes

2010/2011

Uploaded on 09/06/2011

vrunda
vrunda 🇮🇳

4.1

(21)

76 documents

1 / 13

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Prepared By : R.Gowtham
Programming Fundamentals
Overview of Unit – II
Algorithm and Problem Solving
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download Algorithm and Problem Solving - Lecture - Programing Fudamentals and more Lecture notes Programming Languages in PDF only on Docsity!

Programming Fundamentals

Overview of Unit – II

Algorithm and Problem Solving

Prepared By : R.Gowtham

1. Algorithm

An

ordered sequence

of

unambiguous and well-defined

instructions

that

performs some task

and

halts in finite

time

Representation of Algorithms

1.1 Use natural languages – verbose1.2 Flowchart1.3 Pseudo-Code

1.2 Algorithm in Flowchart

Prepared By : R.Gowtham

1.3 Algorithm in Pseudo Code

Algorithm

LargestNumber

  1. Input: A non-empty list of numbers L.3. Output: The largest number in the list L.4. largest ← L05.

for each

item

in

the list L,

do

if

the item > largest,

then

  1. largest ← the item

return

largest

2.6 General problem solving strategies

2.6.1 Divide and conquer strategy2.6.2 Binary doubling strategy2.6.3 Dynamic programming

» Greedy Algorithm» Backtracking» Branch and Bound

Prepared By : R.Gowtham

2.6.1 Divide and conquer strategy

•^

DAC is recursive procedure which divides the problemin to sub problems, whose solution is combined to getthe solution for the original problem.

Example:1.

Binary Search

Merge Sorting

7

2

^

9

4

→→→→

2

4

7

9

7

^ 

2

→→→→

2

7

9

^ 

4

→→→→

4

9

7

→→→→

7

2

→→→→

2

9

→→→→

9

4

→→→→

4

2.6.3 Dynamic programming

Good solution to a large problem can some time build upfrom good or optimal solution to smaller problems.•^

Greedy Algorithm

  • Dijkstra’s algorithm for finding single-source

shortest paths.

•^

Backtracking

  • 8 queen problem.

•^

Branch and Bound

  • Traveling salesman problem.

Prepared By : R.Gowtham

5.Properties of Algorithm

•^

They can be easily modified if necessary.

-^

They are simple but powerful and general solution.

-^

They are documented well enough to be used by otherswho do not have detailed knowledge of their innerworking

-^

They are not dependent on being run on a particularcomputer.

-^

They are able to used as a sub procedure for otherproblems