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
Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.
You are to write your own versions of strcpy() and strlen (). Call them mystrcpy() and mystrlen(). Write them first as code within main(), not as functions, then, convert them to functions. You will pass two arrays to the function in the case of mystrcpy(), the source and target array.
Explain what are the different data types in c?
What is static memory allocation? Explain
How do you print only part of a string?
main() { printf("hello"); fork(); }
What is the use of ?: Operator?
Explain what is page thrashing?
How do you search data in a data file using random access method?
I heard that you have to include stdio.h before calling printf. Why?
PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM
a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor
What is a good data structure to use for storing lines of text?
A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.
Explain about the constants which help in debugging?