Professional Documents
Culture Documents
ArrayLimitationsWhyLinkedList?SimplifiedCoding
SIMPLIFIED CODING
HOME
ABOUT
CONTACT
http://www.simplifiedcoding.net/2015/02/arraylimitationswhylinkedlist.html
1/10
2/12/2015
ArrayLimitationsWhyLinkedList?SimplifiedCoding
2/10
2/12/2015
ArrayLimitationsWhyLinkedList?SimplifiedCoding
http://www.simplifiedcoding.net/2015/02/arraylimitationswhylinkedlist.html
3/10
2/12/2015
ArrayLimitationsWhyLinkedList?SimplifiedCoding
But now I felt that I need to store one more value in my list. I had
declared an array of size 4, but now I need a 5th element, so I asked
to the memory manager that, Hey I want to extend my array A, is
http://www.simplifiedcoding.net/2015/02/arraylimitationswhylinkedlist.html
4/10
2/12/2015
ArrayLimitationsWhyLinkedList?SimplifiedCoding
it possible to do so?
The memory manager replies, Hey, when I allocate a block, I do
not expect that you will ask for an extension so I use whatever
PA: 1
mR: 0.00
0 links
DA: 10
some cases I may extend the same block but in your case I have a
variable X already declared next to your array, so I cannot give you
an extension, this you can consider as one of array limitations,
sorry
This was one of the major array limitations that it cannot be
extended.
I ask the memory manager again, What all options do I have?.
Memory manager says, You have to create a new block and then
we will have to copy all the elements from the previous block into
the new block.
Now this time I declared a large size of array and copied all the
previous element and then stored my 5th element.
But, I felt bad that my list is too small and I am wasting some
memory, and if my still grow too large I may need to re-create a
new array. :(
5/10
2/12/2015
ArrayLimitationsWhyLinkedList?SimplifiedCoding
But before going to know what the Linked List is point out the
array limitations which are:
Array Limitations
Fixed size and cannot be extended, this is one of major array
limitations that you cannot extend the size after creating it.
If we declare a large size of array and store only some
variables memory is getting wasted. This is also one of the
array limitations that if you don't use the whole block memory
is getting wasted.
Memory may not be available for a very large block of array
(This is the very rare case but this is also a possibility and one
of the array limitations).
Now for the above given array limitations the solution is to use
Linked List data structure. And this will be discussed in the next
post friends. Thank You :)
Like
Share
Tweet
6
1
1
7
DataStructures
usingCIntroduct...
Howtowriteand
compileC/C++
Prog...
http://www.simplifiedcoding.net/2015/02/arraylimitationswhylinkedlist.html
6/10