Lab Assignment 10
Sorting-II
Home Works
1.
A FILE/STRUCTURE contains
employee records containing the following information in the order given:
ID
Last
name, First name, Middle name
Street
address
Gender
Phone
Sex
Salary
Write
a program to read these employee records and sort them (Apply ‘built-in QSORT/
your own sort function (any)) so that the ID numbers are in ascending order.
Sample
example:
Input
file:
ID |
name |
address |
phone |
sex |
Salary |
3 |
Abc,xyz |
banani |
1122 |
male |
10000 |
1 |
Qwe,rew |
gulshan |
3232 |
female |
10000 |
2 |
Rtd,fdt |
tejgaon |
3233 |
male |
5000 |
Output:
ID |
name |
address |
phone |
sex |
Salary |
1 |
Qwe,rew |
gulshan |
3232 |
female |
10000 |
2 |
Rtd,fdt |
tejgaon |
3233 |
male |
5000 |
3 |
Abc,xyz |
banani |
1122 |
male |
10000 |
2. Write
a program to sort randomly generated 20 integers using ‘binary’ or ‘natural’
merge sort.