This question already has an answer here:

What is the algorithm used here to sort the answers?

I am planning to develop sorting for my own community answering website, and this sorting algorithm will be very useful in doing so.

marked as duplicate by gnat, fbueckert, Glorfindel support Dec 4 at 16:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • The absolutely most productive Qs get at most dozens of answers. Typically questions get enough answers to count on one hand. So it doesn't matter what sorting algorithm you use. You could use bubblesort and it'd be fine. – Dan Bron Dec 4 at 12:35
  • Thanks. I'll keep in mind while implementing – Rupesh Dec 4 at 12:42
  • Is there other thing like helpful and pinning that affects the order?? – Rupesh Dec 4 at 12:43
  • Yes, accepting an answer that the OP himself did not post pins it to the top of the list. If the OP accepts an answer he posted himself, it's sorted as usual. – Dan Bron Dec 4 at 12:44
up vote 0 down vote accepted

There are three sorting options: 'active', 'oldest' and 'votes'.

enter image description here

  • 'active' sorts on the last activity of the post, which may be the initial posting, an edit, or deletion/undeletion of the answer.

  • 'oldest' sorts on the date/time of initial posting.

  • 'votes' sorts on the answer score, which is the number of upvotes minus the number of downvotes it received.

Sorting is done by the SQL Server database. Databases are good at sorting things, and you should not worry about the implementation, though it sometimes helps if you create the right indices.

Not the answer you're looking for? Browse other questions tagged .