Page 78 - Touchcode_C7_Flipbook
P. 78
A compiler is primarily used for programs which translate source code from a high-level
programming language to a low level language to create an executable program. Concept
of a compiler was invented by Grace Hopper, sometimes called "Amazing Grace".
Coding uiz 01 Critical Thinking
State whether the following statements are true (T) or false (F).
a. A programming language is used to write instructions for computers.
b. Low level languages are not machine friendly.
Coding fact
Sudha Murty is an Indian engineering teacher, author and a social worker.
She is the chairperson of the Infosys Foundation.
SORTING THE LIST—SELECTION SORT
Sorting is arranging the numbers either in ascending order (smallest number to largest
number) or descending order (largest number to smallest number).
Suppose you have a list of unsorted numbers and you want to sort the list in ascending order.
The condition to sort the list is that you don’t have any extra space to store the number; you
have to manage the space given.
To sort the list, you will start by finding the smallest number present in the list. Once you
find the smallest number, you will put it at the top of the list. But where will you place the
number which is already present at the top of the list? You will simply swap or interchange
the number present at the top of the unsorted list with the smallest number.
Now you will follow a similar technique for the rest of the numbers. You will find the smallest
number from the remaining unsorted list and swap it with the number present. You need to
repeat this process till you reach the last number from the list.
When you reach the last element from the list you need to check that all the numbers from
the list are arranged in ascending order. This method of sorting is called ‘Selection Sort’.
Algorithm:
Step 1: Set Minimum number to location 0
76 Touchcode-VII

