What means “breaking ties” in context of sorting


As an interview assignment for software developer, I have received the task. I have a list of children, and the task is: sort children ascending by their birth_date timestamp, breaking ties by ID

The structure of child is:

"child": {
  "id": "14"
  "name": "John"
  "birth_date": "1990-12-20T11:50:48Z"

I can not get the meaning of phrase "breaking ties" in the given context. I guess it can be one of following:

  • if birth_date is the same – first goes child with lower id
  • while sorting using birth_date, ignore - sign.

Best Answer

A tie-break is an extra play when two players have the same number of points, to decide who is the winner.

I never heard this expression in sorting, but transposing from tennis into that area, it means that every thing else being equal, you make an extra comparison on id to decide who's first.

Would you speak of a linked list I would hesitate more, because a tie is also a link or a connection. But even with this meaning, in your context of sorting, the only connection that could make sense would be that of equality.

Related Topic