If my string s size is n and I do something like
s.resize(c); // c < n
will it take constant time or linear?
What will it be in case of c > n.
If my string s size is n and I do something like
s.resize(c); // c < n
will it take constant time or linear?
What will it be in case of c > n.
O_o
The size is not the same as capacity.
If you want to fit the capacity to the contents you'll have to depend on a linear solution or one that isn't portable.
Soma