what is the difference between arrays and linked list

Answer Posted / durairaj

Arrays
Strengths

1.Easy to use
2.No memory management needed
3.Can access any element by index
4.Fairly quick to loop
Weaknesses

1.Static size (can’t increase the size)
2.Most likely not enough or too much memory (you never know
how many elements are needed)
Linked Lists
Strengths

1.Dynamic size (can increase or decrease the list)
2.No memory is wasted
Weaknesses

1.Lots of overhead code (lots of malloc calls and assigning
pointers)
2.Must traverse entire list to go to the nth node.
Now I know that other languages such as C# and Java have
better data structures than arrays and linked lists (like
ArrayLists and Vectors), but this is for the C language and
it doesn’t have those. So based on what you’ve read above
you can decide which is better for the job needed. Neither
arrays nor linked lists are better but they do have their
specific purposes.

Is This Answer Correct ?    23 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the differnce between programing langauge and tool? is sas is a programing langauge r tool?

1891


Explain data types & how many data types supported by c?

570


What is scanf_s in c?

621


if p is a string contained in a string?

1395


Can you please explain the difference between exit() and _exit() function?

580






code for quick sort?

1606


What is indirection?

638


What is a volatile keyword in c?

629


A routine usually part of the operation system that loads a program into memory prior to execution a) linker b) loader c) preprocessor d) compiler

614


How does pointer work in c?

607


What are valid operations on pointers?

656


What is echo in c programming?

541


What is a ternary operator in c?

643


What are the different types of endless loops?

608


What is structure packing in c?

594