You are on page 1of 4

Assignment 11

Deadline: 26th Feb

1. Person Structure
{
Name Char 100
Id integer
Address Char 100
}

Assign some values – at least 15 inside


the program only.

2. Develop a main function to do the series


of the jobs –

main(){

// Declaration of the array [15 size]


Call the array people
// Inserting values for each of the array
elements

struct person *id_sorted;

struct person *name_sorted;


id_sorted = bubblesort_id(people, 15);
name_sorted =
bubblesort_name(people, 15);

print_people(people);
print_people(id_sorted);
print_people(name_sorted);
3. Implement binary search on id and
name.

sample_id = 1;
binsearch_id(id_sorted, sample_id,
0,14);

char *sample_name=”ABCD”;
binsearch_name(name_sorted,
sample_name, 0,14);

binsearch_id() will take the sorted array


of the people and one sample id – will
search the sample_id in the array using
binary search strategy – and print the
details of the person if its present in the
database.
binsearch_name() will take the sorted
array of the people (based on name)
and one sample name – will search the
sample_name in the array using binary
search strategy – and print the details of
the person if its present in the database.

Both binsearch_id and binsearch_name


should be also provided with the range
of the elements in the array to be used
for searching.

The deliverables –
1. main() function along with the structure
declaration and sample values for the fields + the
function calls in series for testing.
Marks 10
2. Printing function definitions in a compatible way
Marks 20
3. Sorting function definitions Marks 30
4. Binary function definitions Marks 40

You might also like