Skip navigation

Tag Archives: sort

How many times have you needed to sort a file based on random or arbitrary criteria?  Well, probably not too frequently, and even if you have the need, you should be able to write one in less time than it takes to find a base.  But let’s ignore that.

One solution might be to do some fancy-schmancy mapping operation on the file, such that your data is preserved, but an alphabetical sort will give you your desired order, after which point you can remove whatever processing you did to it.

That sounds like it would be painful.  Or fun, if you have enough time or an interesting idea crosses your mind.

At any rate, a friend of mine recently was faced with an interesting dilemma, where he needed to sort a file based on some unusual criteria.  Here are the basics of his problem.  He forgot the last few characters in a password, but he was fairly sure they were letters and lower-case numbers.  So, he wanted to prioritize the the order in which he checked the 15 million combinations (62^4).

Read More »