Results 1 to 1 of 1

Math Help - Array resize problem

  1. #1
    Senior Member
    Joined
    Sep 2009
    Posts
    299

    Exclamation Array resize problem

    Hi,

    I need help with this problem if anyone can help.

    Suppose you have an empty array of size $s$. Then you keep inserting elements in it. But before you insert an element, if the array is filled, then you create a new array of size $1+s+\left\lceil\log_2{s}\right\rceil$. You then move every element from the array to this new array (1 move operation per element). Then insert your element to this new array. We then ignore the old array and only insert into this new array. Then $s$ becomes the size of this new array.

    How many move operations (an insert doesn't count as a move) are done in total for $n$ elements inserted if we start with $s=1$?

    Thanks.
    Last edited by Sneaky; March 12th 2013 at 11:04 AM.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. graph to array problem
    Posted in the Math Puzzles Forum
    Replies: 0
    Last Post: May 2nd 2012, 04:01 PM
  2. A problem with LateX array
    Posted in the LaTeX Help Forum
    Replies: 6
    Last Post: March 28th 2011, 07:28 PM
  3. Array Help
    Posted in the LaTeX Help Forum
    Replies: 1
    Last Post: January 31st 2011, 06:42 AM
  4. Matlab data cleaning - cell array to matrix problem
    Posted in the Math Software Forum
    Replies: 0
    Last Post: March 24th 2010, 09:08 AM
  5. resize x maintain y aspect ratio
    Posted in the Algebra Forum
    Replies: 1
    Last Post: May 13th 2008, 10:05 AM

Search Tags


/mathhelpforum @mathhelpforum