Sorting direction is different than sorting order

Here is one more from the sort lover. First, about the inspiration:

***

Ghazals are couplets ending with same set of words called ‘radeef‘, repeating through the poem.

A special type of collection of ghazalsis called a ‘deewan‘.

A deewan is supposed to have ghazals from a single composer and in such a way that there shouldn’t be a letter of the alphabet at which at least one radeef .

That means, if you are composing ghazals in English, your deewan will have at least 26 ghazals, ending with radeef’s from ‘a’ through ‘z’.

***

Now, focus back on sorting.

Ghazals in a deewan are sorted by their ‘radeef‘.  However, this sort is a back-to-front sort.

This is not inverted sorting order. This is a reverse direction of sorting.

For example, if ghazal ‘a’ ends its couplets with ‘mango’, ghazal ‘b’ ends its couplets with ‘banana’ and ghazal ‘c’ ends couplets with ‘apple’, highlighting sorting criteria,

  • Inverted sort would list ghazals in this order: ‘a’, ‘b’, ‘c’ [“mango”, “banana”, “apple”] BUT
  • Radeef sort would list ghazals in this order: ‘b’, ‘c’, ‘a’ [“banana“, “apple“, “mango“]
  • If ghazals sorted by radeef,  a ghazal having radeef “raw banana” will *follow* the ghazal having radeef “ripe banana” because “e” precedes “w”

Here we go. We found one more parameter to sort, apart from inversion or not. Whether it is a normal sort or a radeef  sort.

Advertisements

One comment on “Sorting direction is different than sorting order

  1. […] Most code here is copied from public domain – just Radeef sort idea remains […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s