Skip to main content

Why List wastes less memory as compared to Arrays?

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

Comments

Popular posts from this blog

Drupal Answers Weekly Newsletter - Wednesday, December 31, 2014

Top new questions this week: Can I delete old hook_update_N functions? Suppose you have a custom module, and you have hook_update_N() implementations in your .install file. If you have old update functions, and all updates have run in all sites that the module is ... node-update hook-update-n   asked by AyeshK ...

[New post] 8th Class Result 2014 PEC Hafizabad Board

Muhammad Waqas posted: "PEC Hafizabad Board 8th Class Result 2014 expected date is 28th March, 2014 by PEC. Punjab Examination Commission (PEC) will announce 8th class result for Hafizabad Board soon and all the students of Hafizabad Board who are extremely waiting for the resul" New post on Jobs in Pakistan 8th Class Result 2014 PEC Hafizabad Board by Muhammad Waqas ...

[New post] 1st Year (11th Class) Result 2014 BISE Rawalpindi Board

Xaib Aslam posted: "BISERWP board Inter part 1 result expected on 10th October 2014 according our source. students of Rawalpindi board desperately waiting for 11th class result. 1st they upload the 12th class result and after some time they ready for showing the 1st year fin" New post on Jobs in Pakistan 1st Year (11th Class) Result 2014 BISE Rawalpindi Board by Xaib Aslam ...