State the complex reallocation procedure, Data Structure & Algorithms

Assignment Help:

State the complex reallocation procedure

Some languages provide arrays whose sizes are established at run-time and can change during execution. These dynamic arrays have an initial size used as basis for allocating a segment of memory for element storage. Afterwards array may shrink or grow. If array shrinks during execution, then only an initial portion of allocated memory is used. Though if array grows beyond the space allocated for it, a more complex reallocation procedure must occur, as follows:

1.  A new segment of memory large enough to store the elements of expanded array is allocated.

2.  All elements of the original (unexpanded) array are copied into new memory segment.

3.  The memory used initially to store array values is freed and newly allocated memory is associated with the array variable or reference.

 


Related Discussions:- State the complex reallocation procedure

Selection sort, how to reduce the number of passes in selection sort

how to reduce the number of passes in selection sort

Java, Ask consider the file name cars.text each line in the file contains i...

Ask consider the file name cars.text each line in the file contains information about a car ( year,company,manufacture,model name,type) 1-read the file 2-add each car which is repr

Binary tree construction, Construct a B+ tree for the following keys, start...

Construct a B+ tree for the following keys, starting with an empty tree.  Each node in the tree can hold a maximum of 2 entries (i.e., order d = 1). Start with an empty root nod

Number of operations possible on ordered lists and arrays, Q. Enumerate num...

Q. Enumerate number of operations possible on ordered lists and arrays.  Write procedures to insert and delete an element in to array.

Total impedent of the circuit, an electrical student designed a circuit in...

an electrical student designed a circuit in which the impedence in one part of a series circuit is 2+j8 ohms and the impedent is another part of the circuit is 4-j60 ohm mm program

Nothing, c++ To calculate the amount to be paid by a customer buying yummy ...

c++ To calculate the amount to be paid by a customer buying yummy cupcakes for his birth day party

Procedures, what is far and near procedures in system programming?

what is far and near procedures in system programming?

File organization, Define File organization''s and it''s types

Define File organization''s and it''s types

Basic organization of computer system, what happen''s in my computer when ...

what happen''s in my computer when i input any passage

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd