0% found this document useful (0 votes)
9 views8 pages

Understanding Algorithm

Presentation 3

Uploaded by

sumaiyakorabu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views8 pages

Understanding Algorithm

Presentation 3

Uploaded by

sumaiyakorabu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

sumaiyakorabu@gmail.

com
18FLX746J5
Understanding Algorithm

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
This file is meant for personal use by [email protected] only.
Sharing or publishing the contents in part or full is liable for legal action.
Agenda
• What is an algorithm?
• Why an algorithm is important in problem solving?
• Example of an algorithmic approach in calculating the area of a circle
• Algorithm of a Vending Machine
[email protected]
18FLX746J5

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
This file is meant for personal use by [email protected] only.
Sharing or publishing the contents in part or full is liable for legal action.
What is an algorithm?
• An algorithm is a set of instruction(s)/step(s) to follow to complete a particular task

• Algorithm is the first step that we take when designing a solution of a problem

• It is the blueprint to solve a problem


[email protected]
18FLX746J5

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
This file is meant for personal use by [email protected] only.
Sharing or publishing the contents in part or full is liable for legal action.
Why an algorithm is important in problem solving?
• Algorithm helps to design a solution using simple English language which is easy to
understand

• This helps in identifying potential issues at the beginning

• It also helps to focus on the quality of a solution and the time an algorithm needs for
[email protected]
18FLX746J5
execution

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
This file is meant for personal use by [email protected] only.
Sharing or publishing the contents in part or full is liable for legal action.
Example: Area of a Circle
● To calculate the area of a circle, we need radius as an input
● Formula to calculate an area of circle is = (3.14) * (radius) ^ 2
● The algorithm can be formulated as :
○ Input the radius of a circle
○ Declare a variable - area
○ Calculate and assign, area = 3.14 * (radius) ^ 2
[email protected]
18FLX746J5
○ Return the area as an output

Pseudo Code:
func area(radius:int):
area = 3.14 * (radius) * (radius)
return area

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
This file is meant for personal use by [email protected] only.
Sharing or publishing the contents in part or full is liable for legal action.
Algorithm of Vending Machine
● Algorithm for selecting an item from vending machine:
○ Select an item from vending machine
○ Vending machine will display the required amount
○ Insert the money in vending machine
○ Vending machine will check against the required amount
○ If the amount is more, machine will dispense the difference money and the
[email protected]
18FLX746J5
requested item
○ If the amount is less, it will request for more money
○ If we cancel the request, any inserted money will be returned

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
This file is meant for personal use by [email protected] only.
Sharing or publishing the contents in part or full is liable for legal action.
Summary
• We learned what is an algorithm?
• Why it is important for designing a solution of a given problem statement?
• Saw two examples as how we can use algorithms.

[email protected]
18FLX746J5

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
This file is meant for personal use by [email protected] only.
Sharing or publishing the contents in part or full is liable for legal action.
[email protected]
18FLX746J5

Thank You

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited
This file is meant for personal use by [email protected] only.
Sharing or publishing the contents in part or full is liable for legal action.

You might also like