qt-interest@trolltech.com
[Top] [All Lists]

Re: Différence of QStringLists

Subject: Re: Différence of QStringLists
From: Bernd Brandstetter
Date: Fri, 3 Nov 2006 17:25:26 +0100
On Tuesday 31 October 2006 19:51, Scott Aron Bloom wrote:
> Just hope the lists arent that long...  thats a O(N^2) algorithm
>
> If the lists are sorted, you may want to consider just using the STL
> algorithm, if they are unsorted, you could presort, or convert 1 to a
> set, and then iterate and use the contains on the set.  Then its down to
> a NlogN algorithm
>
> Scott

Another possibility might be to use QSets instead of QLists. QSet provides 
methods like intersect() and subtract() and can be easily converted to and 
from QLists. I don't know how expensive these operations are, though.

Regards,
Bernd

--
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/

<Prev in Thread] Current Thread [Next in Thread>