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
What is the purpose of the statement: strcat (S2, S1)?
console I/O functions means a) the I/O operations done on disk b) the I/O operations done in all parts c) the input given through keyboard is displayed VDU screen d) none of the above
Why isn't any of this standardized in c? Any real program has to do some of these things.
What standard functions are available to manipulate strings?
How can I call a function with an argument list built up at run time?
How many levels of indirection in pointers can you have in a single declaration?
Explain the difference between exit() and _exit() function?
What are the 5 types of organizational structures?
How the c program is executed?
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. 2) the Event Manager has to send participants to the stage to perform in the order in which they registered. Write a program that will help the Event Manager know who to call to the stage to perform. The Logic should be in Data Structures
Why enum is used in c?
What are the valid places to have keyword “break”?
Explain what is operator promotion?
Why we use stdio h in c?
What is hash table in c?