Subject: Re: [xsl] calculating the length ?? From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Date: Mon, 12 Mar 2001 23:59:56 -0800 (PST) |
Hi Anders, There was a lengthy thread in January in which Jeni and I iterated through possible solutions to the problem of finding of a maximum element. What was achieved was an O(N) solution, which worked for an arbitrary node-set with N nodes. Special attention was also paid to minimise the recursive depth of the solution. http://sources.redhat.com/ml/xsl-list/2001-01/msg00354.html Recently I was involved with a similar problem -- find the biggest K elements out of N. While the obvious approach is to repeat k times the process of finding a single max element and this has complexity k*N, I used a much faster algorithm (and implemented it in XSLT), which has complexity of Log2(k)*N. It also uses an implementation of the binary search algorithm. http://www.vbxml.com/snippetcentral/main.asp?view=viewsnippet&id=v20010310050532 Hope this helped. Cheers, Dimitre Novatchev. > I hope You can help me solving my problem. > > <LIST> > <ELEMENT lenght="2"/> > <ELEMENT lenght="10"/> > <ELEMENT lenght="4"/> > </LIST> > > I would like to know what the max length is for the elements, how can I do > that ??? > The result should be 10. __________________________________________________ Do You Yahoo!? Yahoo! Auctions - Buy the things you want at great prices. http://auctions.yahoo.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] calculating the length ??, Michael Kay | Thread | [xsl] Move elements to an upper lev, Borca, Olivier |
[xsl] calculating the length ??, Nielsen Anders Rolan | Date | RE: [xsl] mismatched tags with xsl:, Xavier Defrang |
Month |