Question: C programming A student has to sit on a chair which has specific table's number. Student's tables in the examination hall are in ascending order

C programming

C programming A student has to sit on a chair which has

specific table's number. Student's tables in the examination hall are in ascending

A student has to sit on a chair which has specific table's number. Student's tables in the examination hall are in ascending order based on student id. Some students forget their tables" number during final examination day. Student id is in ascending order with the table's number. For example, the smallest student id value will receive the first table followed by the second student as illustrated in Figure 3. For the solution, you are assigned to develop a system that can sort student id and search the table's number in the examination hall. The data type of student id is integer (int). The system must provide a searching function to find a table. For example, if the student id of 098 wants to find his table's number, the system will show the table's number is "Table 5" as illustrated in Figure 3. If the student id does not exist, the system will show "no match found". As a programmer, your task is to construct sorting function using selection sort algorithm and searching function using sequential search in array. Answer the following questions by referring to the main program in Figure 4 and program output in Figure 5. Table 1 Table 2 Table 3 Table 4 Student id: 004 Student id: 050 Student id: 064 Student id: 078 Table 5 Table 6 Table 7 Table 8 Student id: 098 Figure 3: Illustration of student's table in the examination hall. a) Referring to Figure 3, illustrate the processing cycle of sorting student id using selection sort algorithm which has entries as follows: 78, 98, 4, 64,50. (5 Marks) b) Referring to Figure 4, construct a sorting function using selection sort algorithm for sorting student id. (10 Marks) c) Referring to Figure 4, construct a searching function to find the table's number based on sorted student id using sequential search algorithm. (10 Marks) #include #include void selection_sort(int [], int); void seq_search(int u, int, int); void main() { int i, num_elements, searchValue; int data[7]-78, 98, 4, 64, 50); num elements-5; selection_sort (data, num_elements); printf(" Sorted list for selection sort: "); for(i-0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!