Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: $Revision: 1.6.2.16 $; site ada-uts.UUCP
Path: utzoo!linus!philabs!cmcl2!harvard!think!ada-uts!richw
From: richw@ada-uts.UUCP
Newsgroups: net.lang
Subject: Re: Efficiency of Languages ?
Message-ID: <15100011@ada-uts.UUCP>
Date: Wed, 6-Nov-85 11:04:00 EST
Article-I.D.: ada-uts.15100011
Posted: Wed Nov  6 11:04:00 1985
Date-Received: Sat, 9-Nov-85 06:31:43 EST
References: <15100004@ada-uts.UUCP>
Lines: 29
Nf-ID: #R:ada-uts:15100004:ada-uts:15100011:000:1369
Nf-From: ada-uts!richw    Nov  6 11:04:00 1985


>>> I believe that one can find the N-th highest number in an
>>> unsorted list in less than O(n log n) time...  (me)

> Seems like the nth processor would still have to sort the first n
> numbers from a list of N and at least look at the remaining N-n numbers
> (they can be discarded if they are higher than the current nth number).
>
> The first and last processors are special cases because looking for the
> min and max numbers in a list is a O(N) operation (I think).  They only
> need to look at each list item once. But the 2 to N-1th processors
> still have to work in something close to O(n log n) time.  (George Hart)

Well, I finally did something I should've done a long time ago.
The k-th highest number in an an unsorted list of n numbers be found in
O(n) time.  Non-intuitive, I agree, but "will wonders never cease".
See Aho, Hopcroft & Ullman's "Data Structures & Algorithms",
Addison-Wesley, 1983, pp. 286-290.  In particular, see section
entitled "A Worst-Case Linear Method for Finding Order Statistics",
p. 287.

> Wouldn't it be faster to partition the list, have each processor work
> on a sublist and merge the results?  Given m processors and a list of N
> numbers, this would be a O(N/m log N/m + K) operation where K is the
> time required to merge m sorted lists of N/m numbers.  (George Hart)

Seems like O(N log N) to me.

-- Rich Wagner