Page 76 - Digital_Kids_5
P. 76

Elements of Algorithm

              1.  Input- Data given to the

                  algorithm.                                    Play and Learn
              2.  Output- Result produced

                  by the algorithm.                   Fill in the blanks to complete the algorithm
              3.  Finiteness- Algorithm must  Task: Preparing a glass of lemonade

                  end after a limited number               1.                          (Start/End).
                  of steps.                                2. Take a clean glass.
              4.  Definiteness- Each step                  3. Add                           spoons of sugar.

                  must be clear and exact.                 4. Squeeze the juice of one                               .

              5.  Effectiveness - Every step
                  should be meaningful and                 5. Add                           and stir well.
                  doable.                                  6. Serve and                            (Start/End).

            Types of Algorithms

            While there are countless algorithms, they are often categorized by the problem they

            solve or the approach they take.

              1.  Sorting Algorithms: These arrange data in a specific order, like numbers from smallest
                  to largest or words alphabetically. Examples include Merge Sort and Bubble Sort.
              2.  Searching Algorithms: These are used to find a specific item within a data structure.

                  A common example is Binary Search, which is very efficient for finding an item in a
                  sorted list.

              3.  Recursive Algorithms: These solve a problem by calling themselves with a smaller
                  version  of  the  problem  until  a  base  condition  is  met.  For  instance,  calculating  a
                  factorial is often done recursively.


            Examples of Algorithm


            Example 1- Algorithm to set a School Bag

              1.   Open the bag.

              2.   Take out your school diary.
              3.   See the Time Table.

              4.   Go to your bookshelf.

              5.   Take out the books and notebooks.
              6.   Keep them in a bag.



                Computer —  5                                   76
   71   72   73   74   75   76   77   78   79   80   81