|
Subject: Re: [xsl] Duplicates in a sequence ? From: "Leo Studer leo.studer@xxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 27 Mar 2015 11:16:05 -0000 |
Thanks, makes sense.
> On 27.03.2015, at 12:09, Michael Kay mike@xxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>>
>> I agree the above is O(n^2) with no duplicates. However I wonder how
distinct-values is implemented with Saxon that you say it is O(n log n). What
intrigues me is that the order does not change on Oxygen 16.1.
>>
>
> Saxon's implementation of distinct-values($input) is basically:
>
> HashSet set = new HashSet();
> for each x in $input
> if (!set.contains(x)) {
> set.add(x);
> result.add(x);
> }
> }
>
> except that the code is inverted to make it streamable.
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Duplicates in a sequence , Michael Kay mike@xxx | Thread | [xsl] Confusion during build of lib, Michael Felt aixtool |
| Re: [xsl] Duplicates in a sequence , Michael Kay mike@xxx | Date | Re: [xsl] Increasing sequence ?, Dimitre Novatchev dn |
| Month |