The International Rock Paper Scissors Society holds regional and national champi
ID: 3682710 • Letter: T
Question
The International Rock Paper Scissors Society holds regional and national championships. Each region holds a semifinal competition in which contestants play 500 games of Rock Paper Scissors. The top 20 competitors in each region are invited to the national finals. Assume that you are provided with files for the East, Midwest, and Western regions. Each file contains the following fields for the top 20 competitors: last name, first name, and number of games won. The records in each file are sorted in alphabetical order by last name. Merge the three files to create a file of the top 60 competitors who will compete in the national championship.
I have to create pseudocode for this and I dont know where to start.
Explanation / Answer
open East, Midwest, western files & output file
loop from i=1 to 3
if file i is empty
then Buffer[i]=infinity
else read first record from file i into Buffer[i]
repeat
find largest element of Buffer
if Buffer[s] = ininity
then stop
else output Buffer[s]
if end-of-file(file s)
then Buffer[s]=infinity
else read next record from files s into Buffer[s]
until stop
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.