Algorithm - Definition, Examples - Chapter 11 Class 9 Maths - Definitions

part 2 - Algorithm - Definitions - Chapter 11 Class 9 - The World of Algorithms (Ganita Manjari) - Maths Class 9

part 3 - Algorithm - Definitions - Chapter 11 Class 9 - The World of Algorithms (Ganita Manjari) - Maths Class 9

Remove Ads
Teachoo · Class 9 Explore Class 9

Transcript

Algorithm An algorithm is a precise, step-by-step procedure for solving a problem. For example This is an algorithm for finding the larger of two numbers: Take two numbers, a and b If a > b, report a Otherwise, report b If the numbers are 17 and 23, following the procedure gives 23 An algorithm usually has: Input Instructions Output What makes a good algorithm? Every Algorithm should have Clear steps – Steps are clearly stated so as to avoid errors Algorithm To bro asd ~ What is an Algorithm? ~ A finite sequence of clear, step-by-step instructions to solve a problem. INPUT OUTPUT Two numbers Compare them Greater number : Find the greater number 1 Take two numbers: 12 and 8. 1 2 8 2 Compare: Is 12 > 8? 3 Yes! Output 12. = 12 is greater than 8. ~ | If the numbers are equal, output “Both are equal”. | L A good algorithm has: > aaa < - o= 1OF Clear steps Correct order Adefiniteend Correct result Same steps. Different inputs. + ALGORITHMS < A clear plan to solve a problem An algorithm is a finite sequence ', step-by-step instructions dest Each step has one to solve a problem. Seon d You already use algorithms! Making tea Following a recipe Finding a greater number 1. Boil water 1. Measure 1. Read ( 2. Add tea 2. Mix 2. Compare 3. Pour 3. Cook 3. Report 2) The basic idea s INPUT PROCESS OUTPUT Information you | => Lo Instructions = => [=] The result start with you follow you get Example: 12 and 8 = Comparethenumbers —> 12is greater START Read two numbers, A and B. If A > B, report “A is greater”. Otherwise, if B > A, report “B is greater”. Otherwise, report “Both are equal”. te) porupe® STOP A=12,B=8 A=4,B=9 A=7,B=7 12 > 8 is true 9 > is true Neither is greater Output: 12 is greater Output: 9 is greater Output: Both are equal 5) Three useful building blocks @— SEQUENCE DECISION REPETITION © — _ Dosteps in order. Choose a path using Repeat steps when 3) he a condition. needed. Read -> Compare -> Report Is A > B? Carper caer new pair. This comparison algorithm uses sequence and decisions. Repetition can compare many pairs. 6) What makes a good algorithm? ‘Clear Finite Correct General *\ No confusing (4) Stops after a limited Gives the right Works for all instructions. number of steps. result. o allowed inputs. expresses that plan in code. A | An algorithm is the plan. 2 Correct order – Each step should be in a particular order to give the correct answer A definite end (Finiteness) – Algorithm should stop after a finite number of steps, it cannto go on forever Correct result – It should give the correct result A few important points about Algorithm Algorithm is the steps, not the output A computer program is expressing the steps in code The steps of an algorithm must be clear. Otherwise, we cannot run the steps and it gives an error In this chapter, we will study Algorithms for Mathematical Operations (like Addition, HCF, LCM, Greater than) Algorithm To bro asd

CA Maninder Singh's photo - Co-founder, Teachoo

Made by

CA Maninder Singh

CA Maninder Singh is a Chartered Accountant qualified since 2010 and an educator teaching since 2006. At Teachoo, he draws on his accounting and tax experience to explain Accounts, Income Tax and GST through step-by-step lessons and practical examples.

For an uninterrupted learning experience, students can use Teachoo Black to remove ads and focus better.