I've recently been considering the problem of column packing text - that is taking an arbitrary list of text items, and outputting them in as many columns across the screen as possible (GNU ls does this). The solution in GNU ls works, but is rather brute forcish, and isn't I suspect optimal. In fact, I suspect that for large directories it may take longer than the sort. I stated the problem a bit more rigorously in this PDF document to which the LATeX source is also available.
Current Mood: geeky