Live data from Hacker News

Twitter Sort

github.com

11–20 of 55 posts

Re: Twitter Sort

#11
post #6
post #5

I wonder what's the efficiency of this algorithm in O notation on average.

[deleted]

Big-O notation refers to the worst case runtime of an algorithm.

I have no idea where this misconception comes from.

Big-O notation is a type of bound on a function's growth rate. That function can represent anything. Best case performance, worst case performance, average case performance, memory usage, how many times you are likely to phone someone while you wait, etc.

The standard example showing this is that hash lookups are O(1) or O(n) depending on whether you are asking about the average case or the worst case.

Re: Twitter Sort

#13
post #5

I wonder what's the efficiency of this algorithm in O notation on average.

The probability of the original input list being in the exact order it's in is 1/(n!). If that's the order you wanted then the algorithm might very well approach O(0).

Re: Twitter Sort

#15
post #5

I wonder what's the efficiency of this algorithm in O notation on average.

It's O(whatever algorithm the responder uses), plus a HUUUGE constant for latency and wrong answers.

Re: Twitter Sort

#16
I thought this was going to return them sorted in random order, making a joke about how unreadable the way Twitter sorts conversations is.

Re: Twitter Sort

#17
Hardcoding the validation of the reply is an unfortunate obstacle to scaling this - the server would very quickly become CPU bound. They should really have made a TwitterSortValidationService which sends the answer out to the Twitter API, and then listens for a response confirming whether or not the original sort was correct.

Re: Twitter Sort

#19
post #14

What about the locale of the user producing a different sort order?

They do specify that it's for sorting numbers, as opposed to say, text. Do some locales sort numbers differently?
Post reply on HN