Subject: Re: How the other half live
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Tue, 18 Nov 2008 15:43:45 +0000
|
2008/11/18 Michael Kay <mike@xxxxxxxxxxxx>:
>>
>> for $d in distinct-values($seq) return $d[count($seq[. eq $d]) ge $i]
>>
>> equivalent? I think it is, and probably a lot more
>> efficient, although it is longer.
>>
>
> They are both O(n^2).
Only in the worst case though isn't it, which is a list of unique
values? It's as good as (bad as) distinct-values() plus a bit :)
Whereas:
$vSeq[index-of($vSeq,.)[$i]]
...would be O(n^2) for both best and worst cases - right?
--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
|