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

Re: RE: Simple problem - complicated solution

Subject: Re: RE: Simple problem - complicated solution
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Thu, 16 May 2002 15:12:54 -0700 (PDT)
complicated solutions to simple problems
"Stuart Celarier" <stuart at ferncrk dot com> wrote:

> The solutions that Joerg presented work correctly, but they are both
> O(n^2) solutions. That is computer-science-speak for the processing 
> time is proportional to the square of number of data elements. No big

> deal for small values of n, but definitely a performance problem as 
> the data set gets big. The second one (with the following-
> sibling::datum in the XPath predicates) takes about half the time of 
> the first one, but it is still proportional to n^2.

> For large sets of data, it would be worth looking at an O(n log n)
> solution, 

[the nice description of a min/max algorithm through sourting skipped]

Hi Stuart,

Probably it would be useful to know that there's an O(N) solution. For
example, this algorithm is implemented by the minimuma() and maximum()
functions of FXSL. Another implementation is a simple recursive named
template -- there is an example of this in Dave Pawson's XSLT FAQ.

Cheers,
Dimitre Novatchev.



__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.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.