[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: calculating the length ??

Subject: Re: calculating the length ??
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Mon, 12 Mar 2001 23:59:56 -0800 (PST)
calculating thread length
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.