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

What are the disadvantages of representing a stack or queue by a linked list?

699


What is difference between set and map?

688


What is the impact of signed numbers on the memory?

718


What is faster array or arraylist?

674


Is hashmap sorted?

719


Can hashmap have duplicate keys?

685


What is hash data type?

712


What is stable sort?

757


What is a b+ tree? Explain its uses.

713


Write an algorithm through which the inserting and deleting of elements can take place in circular queue?

702


Write a data structure for a queue.

826


Which is better merge sort or quick sort?

671


Is list a data type?

681


How can someone display singly linked list from first to last?

654


What are the advantages of linked list?

595