why it is difficult to store linked list as an array?



why it is difficult to store linked list as an array? ..

Answer / codex

Its not difficult if you need to copy items in linked list to an array you should traverse the list starting first element and copy each value you pass by to an array.

if you are asking why do we use a linked list rather than array then it's because an array needs to have a fixed size but in a linked list you can add as much items as you can.but If you really need to use an array you can use an arraylist with resize feature.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Structures Interview Questions

What are the advantages and disadvantages of linked list?

0 Answers  


Is array a collection?

0 Answers  


How do hash tables work?

0 Answers  


Explain extended binary tree.

0 Answers  


How can you add an item to the beginning of the list?

0 Answers  






How do you initialize an arraylist?

0 Answers  


What is numeric array?

0 Answers  


Is data structures and algorithms important?

0 Answers  


What is difference between while and do while?

0 Answers  


Define 2-3 tree?

0 Answers  


Describe tree database.

0 Answers  


What is hashing technique?

0 Answers  


Categories