Thread: resize funtion complexity

  1. #1
    Registered User
    Join Date
    Sep 2011

    resize funtion complexity

    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.

  2. #2
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Chennai, India

  3. #3
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008

    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.


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Time Complexity
    By Stuart Dickson in forum C Programming
    Replies: 7
    Last Post: 07-20-2010, 03:13 AM
  2. Complexity
    By spikestar in forum C Programming
    Replies: 9
    Last Post: 02-09-2010, 04:11 PM
  3. complexity
    By ibrahim630 in forum C Programming
    Replies: 7
    Last Post: 06-04-2009, 10:42 AM
  4. Complexity
    By mMarko in forum C Programming
    Replies: 7
    Last Post: 01-07-2009, 03:51 AM
  5. Complexity Problem
    By QuestionC in forum Tech Board
    Replies: 14
    Last Post: 03-26-2007, 01:31 PM
Website Security Test