On Wed, Feb 26, 2003 at 03:49:21PM +0000, Angus Leeming wrote:
> > template<class C>
> > void eliminate_duplicates(C & c)
> > {
> >     for (size_t i = 1; i < c.size(); ++i) {
> >         typename C::iterator ci = c.begin() + i;
> >         if (std::find(c.begin(), ci, *ci) != ci) {
> >             c.erase(ci);
> >             --i;
> >         }
> >     }
> > }
> > 
> > This works fine and is efficient for small size c.

This is O(n^2). 

Are we talking about sorting .bib files or entries in a .bibfiles?
In the first case O(n^2) should not hurt, in the latter it can...

Andre'


-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)

Reply via email to