I came across this challenging program which sort and search for arrays.

The assignment is to create a program that creates, sorts, and searches array. Your program will use both a bubble sort and a selection sort, to the arrays. It will then use both a binary search and a linear to search the arrays.
1. The program must have comments within the program explaining the functioning of the program including comments in each function explaining what it does.
2. The main function is to have two arrays each of 20 integers.
3. It is to call function which will fill one array with random numbers between 1 to 20.
4. Your main function will then copy the array filled with random number to the second array, so that both arrays are filled with the same random numbers.
5. It next calls a function with the first array as input that sorts this array using bubble sort.
6. It then calls a function with the second array that sorts this array using a selection sort.
7. It then calls a function that searches one of the sorted arrays for an input number using a linear search.
8. The main function must output the location of found variable.
9. It then calls a function that searches one of the sorted arrays for the same number but the second function will use a binary search.
10. The main function then outputs the contents of the two sorted tables, so that the sorting can be verified

All i need is to know how do i begin writing then will figure out the rest, I would really appreciate because i need to get this started for my little brother.

Last edited on
Write the outline of your program, and create the functions for each task.
I would then start with #1 and comment your program.
#2 create 2 arrays in main
#3 random number generator and populate array 1
#4 copy array 1 to array 2

Then the fun begins.

Topic archived. No new replies allowed.