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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How many sorting techniques are there?

491


What is dynamic array how is it created?

463


What is an acyclic graph?

604


Is array part of collection framework?

486


What is data structure and why we need it?

496






Write the procedure to convert general tree to binary tree?

549


Define a right-skewed binary tree?

518


In what scenario, binary search can be used?

562


Explain pre-order and in-order tree traversal.

539


Does arraylist allow null values?

505


How do you declare A pointer to array of three chars

529


What are the applications of b-tree?

555


What does arraylist remove return?

454


What is data and its type?

490


What is stack explain with diagram?

512