Re: On the complexity of determining whether n numbers are distinct
- From: Patricia Shanahan <pats@xxxxxxx>
- Date: Mon, 25 Sep 2006 20:00:29 GMT
Ralph Hartley wrote:
Patricia Shanahan wrote:Agreed. It is very silly. It has the same complexity as a good pairwise
comparison sort if k is O(log n). I would only use it if k were small,
That should have been O(n log n)
and smaller than n. For example, sorting thousands of 8 bit bytes.
For the original problem, it is sillier than that!
If k (the largest number) is smaller than n-1, then n numbers can *never* be distinct.
Ralph Hartley
However, for the original problem there is no need to look at an array
element unless it is indexed by one of the input data elements, so it
has time complexity O(n) rather than O(k+n). The space complexity
is still O(k).
Patricia
.
- References:
- On the complexity of determining whether n numbers are distinct
- From: eKo1
- Re: On the complexity of determining whether n numbers are distinct
- From: Markus Triska
- Re: On the complexity of determining whether n numbers are distinct
- From: eKo1
- Re: On the complexity of determining whether n numbers are distinct
- From: Markus Triska
- Re: On the complexity of determining whether n numbers are distinct
- From: Patricia Shanahan
- Re: On the complexity of determining whether n numbers are distinct
- From: goanna
- Re: On the complexity of determining whether n numbers are distinct
- From: Patricia Shanahan
- Re: On the complexity of determining whether n numbers are distinct
- From: Ralph Hartley
- On the complexity of determining whether n numbers are distinct
- Prev by Date: Re: On the complexity of determining whether n numbers are distinct
- Next by Date: Re: On the complexity of determining whether n numbers are distinct
- Previous by thread: Re: On the complexity of determining whether n numbers are distinct
- Next by thread: Re: On the complexity of determining whether n numbers are distinct
- Index(es):