ALGORITHM: STEP 1: Start the program. STEP 2: Read the value of n. STEP 3: Set a for loop to read the elements of array for( i = 0; i < n; i++ ) STEP 4: Call the function sel (a, 0, n – 1 ) STEP 5: Print the sorted array a. STEP 6: Stop the program. FUNCTION SEL (int *x, int start, int stop ) STEP 1: Declare the local variable. STEP 2: Assign begin = start and small = begin and check if start < stop. STEP 3: If so then set a for loop for(i = begin + 1 ; i <= stop; i++ ) STEP 4: Check the condition x[i] < x[small] STEP 6: If so then assign the value of i to small small = i STEP 7: Then swap the values of x[begin] and x[small] using temp temp = x[begin] x[begin] = x[small] x[small] = temp STEP 8: Call another function sel ( x, start + 1, stop ) SAMPLE PROGRAM: #include<stdio.h> #include<conio.h> void sel(int *[],int,int); int main() { int a[100], i, n; clrscr(); printf(" \n Enter the number of eleme...
All HR and Technical interview questions with answers for freshers and experienced professional. It helps job seekers who are about to attend interviews.