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
When should the register modifier be used? Does it really help?
Explain a file operation in C with an example.
What is p in text message?
Explain the binary height balanced tree?
What are the ways to a null pointer can use in c programming language?
What is pass by reference in functions?
what is the c source code for the below output? 10 10 10 10 10 10 10 10 10 10 9 9 7 6 6 6 6 6 6 9 7 5 9 7 3 2 2 5 9 7 3 1 5 9 7 3 5 9 7 4 4 4 4 5 9 7 8 8 8 8 8 8 8 8 9
What does emoji p mean?
how to make a scientific calculater ?
Write a program to print fibonacci series without using recursion?
What is new line escape sequence?
write a progrmm in c language take user interface generate table using for loop?
What are types of preprocessor in c?
Explain b+ tree?
how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.