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
differentiate built-in functions and user – defined functions.
In a header file whether functions are declared or defined?
What is the purpose of the preprocessor directive error?
Write program to remove duplicate in an array?
Do you know null pointer?
What is operator precedence?
How can you increase the allowable number of simultaneously open files?
code for find determinent of amatrix
Explain what is the difference between a string and an array?
What is the benefit of using #define to declare a constant?
Explain c preprocessor?
What is #include stdio h?
What is linear search?
In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none
develop algorithms to add polynomials (i) in one variable