Analyst Integration Question: Download Integration Programmer PDF

Can you please explain the difference between linked list and an array?

Tweet Share WhatsApp

Answer:

linked list and array are two of the most important data structure in programming world. Most significant difference between them is that array stores its element at contiguous location while linked list stores its data anywhere in memory. This gives linked list enormous flexibility to expand itself because memory is always scattered. It's always possible that you wouldn't be able to create an array to store 1M integers but can do by using linked list because space is available but not as contiguous chunk. All other differences are result of this fact. For example you can search an element in array with O(1) time if you know the index but searching will take O(n) time in linked list. For more differences see the detailed answer.

Download Integration Programmer PDF Read All 41 Integration Programmer Questions
Previous QuestionNext Question
Explain shell script?Explain regular expression?