Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this assignment, you will prepare a C + + program that uses linked lists to solve a problem. In many large companies, there are
In this assignment, you will prepare a C program that uses linked lists to solve a problem. In many large companies, there are socials for the new hires that involve collecting handshakes or other interactions from the other participants. We would like to identify the first person to interact with all other participants.
For example, consider a group of four participants: A B C and D
The interactions, in order are:
A B
A C
B D
B C
A D
C D
Given this ordered set of pairings, we conclude that participant B is the first to interact with all of the other participants. In interaction A and B meet. In interaction B and D meet. Finally, B and C meet in interaction At this point, B has met all other participants, while A has not met D C has not met D and D has not met A or C
The order that B has met the other participants is: A D C
Requirements:
The purpose of the program is to identify the winner and report the order of interactions with the other participants. Output the winner, the first participant to interact with all the other participants, on the first line. Output each other participant, in order of interaction, one per line. In the case of a tie between two participants, output only the one listed first in the pair as the winner.
Make good use of functions and classes to implement the Lists necessary to solve this problem. You may use an arraybased or linklist based implementation to keep track of the interactions. Your program should read the requested file, using the ArgumentManager, and output to the requested file.
All input files will start with a single integer on the first line that indicates the number of participants. Each subsequent line will contain a pair of values that represent the interaction between two participants. These values can be integers or strings and are separated by a single space. The entries are always valid, and always consist of only two valid participants per line. Participants in each file are either strings or integers, not both. You may not use Vectors. You should use the List implementations you have created for lab.
Input File:
Output File:
First:
In this example, there are participants numbered to They interact in pairs as shown in the input file. The winner is participant number as noted in the first line of the output file. The order of interactions is and then These interactions are enumerated and separated by a comma and space, on one line, in the output file. This means that the solution should provide a means to track the interactions and the order they occur.
Note: A pairing can occur in either order and a pairing between the same two participants can appear multiple times in a file. Only consider the first pairing of any two participants
IMPORTANT: Homework is individual. Your homework will be automatically screened for code plagiarism against code from the other students and code from external sources. Code that is copied from another student for instance, renaming variables, changing for and while loops, changing indentation, etc. will be detected and result in a for your homework grade. The limit is similarity.
Homework must be submitted to the class Linux server.
Make sure to create a folder under your root directory, and name it hwcase sensitive copy any cpp and h file to this folder, ArgumentManagerh needs to be included as well.
Be sure that your file names do not include spaces, or the testing script will fail.
You do not need to include any of the input, output, or answer files into the folder, but you may wish to upload these files for testing purposes.
Be sure to grant permission to the folders for grading.
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