Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You have been asked to develop software to help with a competition. Here are the functionalities your software must support: 'I. It should keep track
You have been asked to develop software to help with a competition. Here are the functionalities your software must support: 'I. It should keep track of each participant's name and score. 2. Since you will not know how many people may participate in a competition, use a doublelinked list to keep track of all participants. 3. Keep the list always sorted in nonincreasing order. You can do that by inserting each element at the correct position in the link list after reading it from the le. If duplicate entries exist, only insert the rst entry and reject the successive ones. 4. You may need to keep track ofthe linked list's head and tail. 5. After building the linked list, perform an indexing operation on the linked list. That is, declare an Node **a rr, and have each pointer pointing to an element of the list. Write a function void build_index() in the class that: o Creates an array of pointers using the Node **a rr variable. The size of the array will be equal to the number of entries in the linked list. 0 Then, make each pointer, denoted by arr [i], point to an element of the linked list. 6. After you build the linked list, you will display a menu with the following options: 0 l) BinarySearchWithRecursion: which takes a score as input and prints the name of a participant with that score. Implement BinarySearch with recursion and report the rst participant the search algorithm encounters with that score. This participant may not be the rst in the ordered linked list. Also, report the number of comparisons. Use the recursive algorithm for binary search. If no participant has that score, then print a message \"'Could not find: Y Number of comparison: X\"'. Here, Y represents the target score and X represents the number of comparisons performed. If the score exists, then print the name of the player your BinarySearch algorithm finds first and the number of comparisons. The output will look like this: \"'Player Z with score: Y Number of comparison: X\"'. Here, Z is the player's name, Y is the target score, and X is the number of comparisons. You may need to implement a string get_name(int index) getting function that takes the index as input, and returns the corresponding player's name as output. This index is the index into the arr array. You can use arr[index]>name to get the player's name. 0 2) HighestScore: Print the names of people with the highest score. Since there can be multiple people with the same score, print all their names. 0 3) LowestScore: Print the names of people with the lowest score. Since there can be multiple people with the same score, print all their names. 7. Use a class to contain the linked list. Each node of the linked list can be of structure type. 8. Declare appropriate Constructor and Destructor functions. 9. Declare appropriate setter and getter functions, it needed. Input UT W Menu 1. Lookup by score 2. Display highest scorer 3. Display lowest scorer 4. Display ranked list 5. Quit Enter your choice: Lowest Scorers: Oliver Abildgaard 0 Jan Bednarek 0 Alexander Callens 0 Ousmane Camara 0 Joao Cancelo 0 Antonio Candreva 0 Thomas Cannon 0 Sergi CanUs 0 Your output Ander Capa 0 Andrea Carboni 0 Valentin Carboni 0 Irvin Cardona 0 Igor Carioca 0 Jose Carlos Lazo 0 Jose Carlos Lazo 0 Casemiro 0 Menu 1. Lookup by score 2. Display highest scorer 3. Display lowest scorer 4. Display ranked list 5. Quit Enter your choice: Quitting the program. Menu 1. Lookup by score 2. Display highest scorer 3. Display lowest scorer 4. Display ranked list 5. Quit Enter your choice: Jose Carlos Lazo 0 Igor Carioca 0 Valentin Carboni 0 Andrea Carboni 0 Ander Capa 0 Sergi CanUs 0 Expected output Thomas Cannon 0 Antonio Candreva 0 Joao Cancelo 0 Ousmane Camara 0 Alexander Callens 0 Oliver Abildgaard 0 Menu 1. Lookup by score 2. Display highest scorer 3. Display lowest scorer 4. Display ranked list 5. Quit Enter your choice
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started