I dont even know where to start since I am struggeling with the whole pseudocode process. Here is the scenario.

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 you are provided with files for East, Midwest, and Western regions. Each file contains the following feilds for the top 20 contributers: last name, first name, and number of games won. The records in each file are sorted in alphabetical order. Merge the three files to create a file for the top 60 competiters who will compete in the national championship.

Recommended Answers

All 2 Replies

I dont even know where to start since I am struggeling with the whole pseudocode process.

Pseudocode is nothing more than a structured way to organize your algorithm's steps. For example, the following is a valid (but largely useless as it stands) pseudocode program:

Open the east file
Sort the east file
Open the midwest file
Sort the midwest file
Open the west file
Sort the west file
Merge east, midwest, and west
Save the merged results to a new file

The benefit to this is you can iteratively add more detail and specific steps. For example:

Open the east file
Sort the east file
Open the midwest file
Sort the midwest file
Open the west file
Sort the west file

# Merge and save the three files
From i, j, k = 1 until 20
    If i <= 20 AND east[i] Is min(east[i], midwest[j], west[k])
        Save east[i]
        Increment i
    Else If j <= 20 AND midwest[i] Is min(east[i], midwest[j], west[k])
        Save midwest[j]
        Increment j
    Else If k <= 20 AND west[i] Is min(east[i], midwest[j], west[k])
        Save west[k]
        Increment k
Repeat

This process is for collecting your thoughts into something more formal than just a list of requirements. It helps you write code without the need to meet syntax and semantics rules for any specific language, so you're constrained only by the rules of logic. All of the "syntax" for the pseudocode above was completely invented on the spot. Any resemblance to an actual programming language, or matching consistent rules for any real programming languages comes from my experience writing code and nothing more. You could use even more natural language syntax if you wanted, but that does make conversion into real code slightly more difficult.

Thank you so much deceptikon, I couldnt express my gratitude more. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.