Re: (OT) path_helper [was Re: Xterm not reading dotfiles]
Re: (OT) path_helper [was Re: Xterm not reading dotfiles]
- Subject: Re: (OT) path_helper [was Re: Xterm not reading dotfiles]
- From: "Andrew J. Hesford" <email@hidden>
- Date: Mon, 19 Nov 2007 21:10:07 -0600
On Nov 19, 2007, at 8:31 PM, Vernon Williams wrote:
Monday, November 19, 2007, 6:14pm
I would be interested in seeing what kind of bookkeeping you would
do to remove the second sort. Not that it would probably make much
difference in speed, but I love algorithms, love coming up with them,
love getting new ideas.
If one wasn't trying to preserve the original order of the remaining
values, one clearly would not need the second sort.
For something I thought would be a stupid feature, Quick Look is
pretty sweet. Now I can look at attachments (like yours) without
downloading them. This is especially useful for source code, where I
would have had to download the file, open a terminal, and open the
file in Vim (to avoid starting Xcode). No reality distortion field
here--Jobs was right when he said Quick Look saves a bunch of time!
Your method is similar to what I had in mind. Just create an array the
size of your original data array, and as you loop through the sorted
data, populate the second array with some value only when you reach
the first occurrence of a (possibly duplicated) value. Then, you have
an array of NULL values interspersed between the unique values. When
you loop to do the printing, you just ignore the NULL values.
Of course, this uses extra memory, but memory is cheap! And the
complexity drops from O(N log N) to O(N). A classic programming trade-
off. I'm thinking there is a way to do this with just some extra index
offset variables, instead of a whole new array. However, I can't
confirm or refute this without thinking about it just a bit more than
I want to. :-P
Cheers,
Andrew
--
Andrew J. Hesford <email@hidden>
Department of Electrical and Computer Engineering
University of Illinois at Urbana-Champaign
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden