On 05/11/2011 01:54 PM, Tim wrote: > Back when I worked in a library, one of our fears was that some > miscreant would tip out the card file index, and we'd have to spend an > unimaginable amount of time putting the cards back in order. Yes, I know. Back in the mid '80s I did a little work for a concrete company who had an early mini-computer. One day the data entry girl came over and asked if I could speed up the program that sorted the list of customers. It had roughly 300 names and took an hour to sort -- far longer than it took her to do it by hand. Whoever wrote it was using a disk file as an array (It was built into the BASIC for that computer.) and doing a bubble sort, moving each element every time it shifted. I re-wrote it as a Shell Sort, changing only the pointers. After the sort was over, I copied the old file into a new one in the order of the array of pointers, deleted the old file and renamed the new one. It took about three minutes. Then, in a blinding display of ingratitude, she complained because the new sort wasn't stable: if entry N and N+3 were equal, they might end up in reverse order unlike the bubble sort which would keep that relationship unaltered. Of course, she hadn't specified that she wanted (not, mind you, needed) that before hand. -- users mailing list users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines