# Sort by favorites? November 10, 2010 11:20 AM Subscribe

Sort by favorites?

Can anyone think of a clever way to sort comments (I'm thinking long AxMes as an example) by # of favorites per comment? Metafilter itself doesn't currently support such a thing, I know, but I'm wondering if there's some sort of simple greasemonkey-type script you could run on the page to produce the same result?

Can anyone think of a clever way to sort comments (I'm thinking long AxMes as an example) by # of favorites per comment? Metafilter itself doesn't currently support such a thing, I know, but I'm wondering if there's some sort of simple greasemonkey-type script you could run on the page to produce the same result?

Paste into Notepad and perform an insertion sort using cut and paste.

posted by Wolfdog at 11:24 AM on November 10, 2010 [5 favorites]

posted by Wolfdog at 11:24 AM on November 10, 2010 [5 favorites]

Never heard of such a thing, nor anyone ask for it.

posted by 2bucksplus at 11:25 AM on November 10, 2010

posted by 2bucksplus at 11:25 AM on November 10, 2010

Yeah, that bookmarklet jedicus mentions does exactly what you want.

posted by mathowie (staff) at 11:25 AM on November 10, 2010

posted by mathowie (staff) at 11:25 AM on November 10, 2010

thanks. close me out.

posted by leotrotsky at 11:30 AM on November 10, 2010

posted by leotrotsky at 11:30 AM on November 10, 2010

*Paste into Notepad and perform an insertion sort using cut and paste.*

A bubble sort is better suited to Notepad.

posted by DU at 11:40 AM on November 10, 2010

I'm really glad this thread has been closed. It really could've turned into a big stinkfest the way things have been going around here.

posted by slogger at 11:45 AM on November 10, 2010

posted by slogger at 11:45 AM on November 10, 2010

I prefer to launch emacs, mash m-x yow a few dozen times, and then bogosort until such time as we are having fun yet.

posted by cortex (staff) at 11:46 AM on November 10, 2010 [4 favorites]

posted by cortex (staff) at 11:46 AM on November 10, 2010 [4 favorites]

Real programmers launched emacs over a year ago.

Seriously, I have an emacs process here with a start time of "2009". The other one is "Aug20".

posted by DU at 11:50 AM on November 10, 2010

Seriously, I have an emacs process here with a start time of "2009". The other one is "Aug20".

posted by DU at 11:50 AM on November 10, 2010

...and they're still waiting for it to load! A-haha.

posted by Wolfdog at 11:51 AM on November 10, 2010 [7 favorites]

posted by Wolfdog at 11:51 AM on November 10, 2010 [7 favorites]

Also, there's a bug in NotePad that interferes with bubble sort.

posted by Wolfdog at 12:13 PM on November 10, 2010

posted by Wolfdog at 12:13 PM on November 10, 2010

1. Randomly distribute the comments an infinite number of times.

2. Remove anything that isn't sequential.

3. Sort them by the biggest number of favorites on the first comment.

done and done.

posted by blue_beetle at 12:38 PM on November 10, 2010

2. Remove anything that isn't sequential.

3. Sort them by the biggest number of favorites on the first comment.

done and done.

posted by blue_beetle at 12:38 PM on November 10, 2010

Personally, I prefer to read my comments chronologically in order of increasing awesomeness. Noticing that there's a given number of comments associated to each comment, I then apply the Robinson-Schensted-Knuth algorithm to the set of comments on a given thread. Here's how that works: You start with a sequence of integers, and arrive at a Semistandard Young Tableau (SSYT), in the following way. At each step, remove the first number (say, K) from your sequence, and insert it into the tableau. If the number is (strictly) greater than the largest number in the row you are considering, place the K at the end of that row. If the row is empty, just place K into the row. Otherwise, replace the smallest number larger than K (which we'll call K') with the K, and perform the insertion of K' into the next row. (This is called a 'bump.')

Example:

Take the sequence S=(0,3,0,0,0,3,0,6,0,0,0), which is the sequence of favorites in this thread, as of this writing.

Insert the first 0 to get the tableau:

0

Inserting the 3 gives:

03

Inserting the next 0 'bumps' the three to give:

3

00

and so on, until we get:

336

00000000.

Now, it's a fact of the RSK algorithm that:

1) The length of the rows (from bottom to top) are weakly decreasing, and

2) The length of the first row is the length of the longest weakly increasing subsequence of S, and its entries are linked to comments in that sequence.

Furthermore, I can extend my fun by reading the second row, which has the length of the longest increasing subsequence once the first is removed, and so on.

Also if I'm a killjoy, and like reading comments chronologically in order of decreasing favorites, I can just just read by the columns...

posted by kaibutsu at 12:34 PM on November 11, 2010

Example:

Take the sequence S=(0,3,0,0,0,3,0,6,0,0,0), which is the sequence of favorites in this thread, as of this writing.

Insert the first 0 to get the tableau:

0

Inserting the 3 gives:

03

Inserting the next 0 'bumps' the three to give:

3

00

and so on, until we get:

336

00000000.

Now, it's a fact of the RSK algorithm that:

1) The length of the rows (from bottom to top) are weakly decreasing, and

2) The length of the first row is the length of the longest weakly increasing subsequence of S, and its entries are linked to comments in that sequence.

Furthermore, I can extend my fun by reading the second row, which has the length of the longest increasing subsequence once the first is removed, and so on.

Also if I'm a killjoy, and like reading comments chronologically in order of decreasing favorites, I can just just read by the columns...

posted by kaibutsu at 12:34 PM on November 11, 2010

I quite like quantum bogosort for this, shuffle the comments randomly, if they aren't in favourites order then destroy the universe. By the many-worlds interpretation any remaining observers will have the comments appropriately sorted after only one iteration.

Destroying the universe is left as an exercise for the reader.

posted by markr at 2:00 AM on November 12, 2010

Destroying the universe is left as an exercise for the reader.

posted by markr at 2:00 AM on November 12, 2010

You are not logged in, either login or create an account to post comments

posted by jedicus at 11:24 AM on November 10, 2010