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 is binary tree give example?

0 Answers  


What does it mean to sort an array?

0 Answers  


What is stack and its operations?

0 Answers  


What is a list of lists?

0 Answers  


Explain binary searching and Fibinocci search?

0 Answers  






What are the standard ways in which a graph can be traversed?

0 Answers  


Can you sort a hashmap?

0 Answers  


Does treemap allow null key?

0 Answers  


Is arraylist heterogeneous?

0 Answers  


What is the need for path compression?

0 Answers  


What is the meaning of anonymous array? Explain with an example?

0 Answers  


Name the areas in which you can apply data structures extensively?

0 Answers   Accenture,


Categories