However, I'd expect the memory complexity to be O(1) or O(log n).

You'll note that the SGI implementation (cfr the link you posted) mentions that the introsort algorithm is used. The introsort algorithm has an O(log n) memory complexity.

Solved

Posted on 2011-09-13

Hi there,

I am interested in finding out the amount of memory that is being used by stl's sort.

I have read the link :http://www.sgi.com/tech/stl/sort.html and there is mention about complexity but nothing about memory .

Could anyone please direct me to the link ?

Thanks,

I am interested in finding out the amount of memory that is being used by stl's sort.

I have read the link :http://www.sgi.com/tech/s

Could anyone please direct me to the link ?

Thanks,

4 Comments

However, I'd expect the memory complexity to be O(1) or O(log n).

You'll note that the SGI implementation (cfr the link you posted) mentions that the introsort algorithm is used. The introsort algorithm has an O(log n) memory complexity.

http://en.wikipedia.org/wi

Find out what's teh implementation (STL code would anyway be available) and then refer to the table in this page, it has the memory complexity described for most common algorithms.

Or did you mean you want a real number, say in KB?

- For that easiest is to run with a profiler (E.g. Rational Quantify)

- Or you can write some code like this or this depending on your needs.

The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**22** Experts available now in Live!