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.)

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

start
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.

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.