I am having a real tough time understanding the logic involved in writing the pseudocode for the following problem. Any help would be greatly appreciated and beneficial. If someone could please show me an example of how they would write the pseudocode for this problem, I could learn from the example. Please help!!

The village of Ringwood has taken a special census. Every census record contains a household ID number, number of occupants, and income. Ringwood has exactly 75 households. Village statisticians are interested in the median household size and the median household income. Develop the logic for a program that determines these figures. (Remember, a list must be sorted before you can determine the median value.)

7 Years
Discussion Span
Last Post by BestJewSinceJC

Hopefully I am on the right track- I got the sort part written. Need help with finding the median...

num occupant
num income
num SIZE = 75
num houseId
fillArray (houseId,SIZE)
sortArray (houseId, SIZE)
displayArray (houseId,SIZE)


Well if the number of elements in the array is odd, it is logically the number directly in the center. Otherwise, it is the two numbers in the center added together and divided by two.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.