Assume that following initialization is given in your structure allStudent[5] and data is sorted based on name field,   struct studInfo {   int    stNr;     char name[10]  ;     int    grade; }; int main()                              // already sorted base on name field {  struct studInfo  allStudent[5]={    97790, “ADEM”  , 77,                                                                                   963582, “AFGAR” ,  85,                                                                      957434 ,”AHMED”,  100,                                                                      921229 ,”BAKI” ,  65,                                                                      971280 ,”ZEKI” , 88}; int n=5;/* Total number of students*/ char givenName[10]; gets(givenName); k=binarySearch(………..); … …. sortBubble(……); .. .. .. return 0; }   A) Write a C function named as binarySearch() and search a given student(get a name information from the monitor) in the given array allStudent[] , apply Binary Search , and list student information(stNr , name , grade).If student in not found give an error message in the main() program that “Student is not found”.   B)Write a C function named as sortBubble()  that will sort the student information  by Student Number(stNr) applying by Bubble Sort method, and after sort operation list sorted student information in the main program.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Assume that following initialization is given in your structure allStudent[5] and data is sorted based on name field,

 

struct studInfo

{   int    stNr;

    char name[10]  ;

    int    grade;

};

int main()                              // already sorted base on name field

{

 struct studInfo  allStudent[5]={    97790, “ADEM”  , 77,             

                                                                     963582, “AFGAR” ,  85,

                                                                     957434 ,”AHMED”,  100,

                                                                     921229 ,”BAKI” ,  65,

                                                                     971280 ,”ZEKI” , 88};

int n=5;/* Total number of students*/

char givenName[10];

gets(givenName);

k=binarySearch(………..);

….

sortBubble(……);

..

..

..

return 0;

}

 

  1. A) Write a C function named as binarySearch() and search a given student(get a name information from the monitor) in the given array allStudent[] , apply Binary Search , and list student information(stNr , name , grade).If student in not found give an error message in the main() program that “Student is not found”.

 

B)Write a C function named as sortBubble()  that will sort the student information  by Student Number(stNr) applying by Bubble Sort method, and after sort operation list sorted student information in the main program.

 

Expert Solution
steps

Step by step

Solved in 3 steps with 6 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY