Hacker News new | ask | show | jobs
by Liru 1380 days ago
I had to reread this comment multiple times since I felt that I had a fundamental failure of reading comprehension somewhere along the line.

> The problem statement says "find the record" but all the answers are about printing the median age.

> So answer to the question posed? None of the above.

The problem statement does not say "find the record". The problem statement says, fully quoted:

> Rank the responses in the order of their relative concern with programming considerations, economic considerations, or other important considerations. If you were the programmer, which approach would you prefer? If you were Mary Jones, which approach would you prefer?

2 comments

Indeed. The question asks you to rank responses. Furthermore,

> The problem statement says "find the record" but all the answers are about printing the median age.

No. it doesn't. It asks you to "compute the median age" without asking about any records.

> she has a file of personnel records [2022 update: an Excel sheet] and asks you to develop a program to compute the median age of the personnel in the file. Here are four different ways you might respond:

So the textbook asks you to rank possible ways to respond, and the hypothetical is just asking "can you process this list and tell me the median age". No one in any context is asking for a record.

You’re right. I was looking at option A. Therefore radix sort is strictly the right answer. Simple, easy to read, easy to understand and an order of magnitude faster.
If you cared about speed, you wouldn't sort at all.