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

How many types of search algorithms are there?

0 Answers  


What is a cycle or a circuit?

0 Answers  


What does enum do?

0 Answers  


Can sets contain duplicates?

0 Answers  


Why do we need sorting algorithms?

0 Answers  






what is the difference between dynamic as well as non - dynamic data structures.

0 Answers   Aricent,


What's the difference between an array and vector?

0 Answers  


What is binary tree?

13 Answers   BMC,


Write the programs for Linked List (Insertion and Deletion) operations

9 Answers   College School Exams Tests, Persistent, TCS,


How do you find the index of an element in an arraylist?

0 Answers  


Is merge sort better than quick?

0 Answers  


What are the advantages of stack?

0 Answers  


Categories