Q: Why List wastes less memory as compared to Arrays.
A: 1. Linked lists do not need contiguous blocks of memory; extremely large data sets stored in an
array might not be able to fit in memory.
2. Linked list storage does not need to be preallocated (again, due to arrays needing contiguous
memory blocks).
3. Inserting or removing an element into a linked list requires one data update, inserting or
removing an element into an array requires n (all elements after the modified index need to be
shifted).
Array is a collection of same data type. In linked list there are two field one is address and other
is pointer. In array elements are arranged in a specific order
Join Our Groups: http://groups.google.com/group/vubest
Like Vubest on Facebook
A: 1. Linked lists do not need contiguous blocks of memory; extremely large data sets stored in an
array might not be able to fit in memory.
2. Linked list storage does not need to be preallocated (again, due to arrays needing contiguous
memory blocks).
3. Inserting or removing an element into a linked list requires one data update, inserting or
removing an element into an array requires n (all elements after the modified index need to be
shifted).
Array is a collection of same data type. In linked list there are two field one is address and other
is pointer. In array elements are arranged in a specific order
Join Our Groups: http://groups.google.com/group/vubest
Like Vubest on Facebook
Comments
Post a Comment