Answered step by step
Verified Expert Solution
Link Copied!

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 1, A and B meet. In interaction 3, B and D meet. Finally, B and C meet in interaction 4. 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 array-based or link-list 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:
5
23
34
03
01
04
14
13
24
02
12
Output File:
First: 3
2,4,0,1
In this example, there are 5 participants numbered 0 to 4. They interact in pairs as shown in the input file. The winner is participant number 3 as noted in the first line of the output file. The order of interactions is 2,4,0, and then 1. 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 0 for your homework grade. The limit is 80% similarity.
Homework 1 must be submitted to the class Linux server.
Make sure to create a folder under your root directory, and name it hw1(case sensitive), copy any .cpp and .h file to this folder, ArgumentManager.h 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands-On Database

Authors: Steve Conger

2nd Edition

0133024415, 978-0133024418

More Books

Students also viewed these Databases questions