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 to insert a new node in linked list where free node will be available?

557


What is link list in data structure?

462


Sorting is not possible by using which of the methods?

486


What is data structure explain in detail?

504


What are different methods of collision resolution in hashing.

490






Can we add duplicate keys in a hashmap?

499


What do you mean by selection sort?

478


What are the topics in data structures?

500


Can you override methods of arraylist?

490


Which is better arraylist or linkedlist?

453


Explain the term run-time stack?

613


What is homogeneous array?

456


How do you clear a stack?

516


What is the family trees and connection by clause?

485


What is the need of sorting?

502