Two Irish Rail delays happen equally often. Does that mean there’s no mode?
Your train was two minutes late on some days and six minutes late on others. Those two delays happened equally often, and no other delay happened as often. If someone asks for the most common delay, what should your program report?
Start with six train delays measured in minutes. Put matching readings together: the twos, the single five, and the eights. Count the readings in each group. Your frequency table records each distinct delay and how many times it occurred.
Read down the count column: two, one, three. Three is the greatest count. Now move across that row to the delay column. The delay you collect is eight minutes. If more rows had that greatest count, you’d collect their delays too.
In another frequency table, four minutes occurs twice, six minutes occurs three times, and nine minutes occurs once. Look for the largest count, then pick the delay that goes with it.
A value with the greatest count is called a mode. If several values share the greatest count and another value has a lower count, report all the tied values. We use this convention: if two or more distinct values all have equal counts, report no mode.
Here, f of a delay means its count. Two minutes occurs twice, four minutes occurs once, and six minutes occurs twice. The greatest count is two. Scan the rows in order: collect two minutes, skip four minutes, then collect six minutes. Return both collected delays.
Now try another frequency table. Three minutes occurs four times, five minutes occurs once, and seven minutes occurs four times. Which delays should your program report? Pick one answer.
In the last question, four tells you how many times each winning delay occurred. If you return four minutes, you’ve used the count as a delay. Use the count to find the matching rows, then return their delay values: three minutes and seven minutes.
For an exam-style question, write an algorithm to find the modes from a frequency table. In Python, map each value to its count. Return an empty list if the table is empty. Find the highest and lowest counts. If several values all tie, return an empty list. Otherwise, collect every value matching the highest count.