Semester : S1 and S2
Subject : Computer Programming
Year : 2017
Term : DECEMBER
Branch : BIOTECHNOLOGY
Scheme : 2015 Full Time
Course Code : CS 100
Page:34
int z;
رو ہے
printf("Multiply : %d\n",z);
return 0;
ர்
div(int x, int 9)
டா
int Z;
257/3;
printf("Div : %d\n",z);
return റ;
PART C
7 ഒ) With the help of an example C program explain Selection sort
Selection Sort
Consider the following depicted array as an example.
20 ھ2
تا
For the first position in the sorted list, the whole list is scanned sequentially. The first position where
14 is stored presently, we search the whole list and find that 10 is the lowest value.
3020 ०००६
So we replace 14 with 10. After one iteration 10, which happens to be the minimum value in the list,
appears in the first position of the sorted list.
(0 | || 27 | 14 || ॐ | 7
For the second position, where 33 is residing, we start scanning the rest of the list in a linear
manner.
swap these values
10 || ॐ | 2 0 0 ۳ | 44
After two iterations, two least values are positioned at the beginning in a sorted manner.
| 611
The same process is applied to the rest of the items in the array. Following is a pictorial depiction
of the entire sorting process —