what is the difference between arrays and linked list
Answers were Sorted based on User's Feedback
Answer / shweta
In array,memory is managed randomly...
but, in linked list memory is managed in a heap concept..
Is This Answer Correct ? | 13 Yes | 6 No |
Answer / thanu
arrays: staticaly allocating memory
easy to traverse
memory wastage
linked list:runtime allocation
difficult to traverse
efficient usag of memory
Is This Answer Correct ? | 8 Yes | 2 No |
Answer / jyoti
1.In case of array storing is easy and simple rather than
that of linked list because linked list need more space to
store same amount of data than amount of memory required by
array.
2.In case of linked list operations like
insertion,deletion,merging etc are easy than that of array.
3.Size of array is predefined but in case of linked list it
is defined at run time.
4.Array is randomly accessed but list is sequentially
accessed only.
5There is problem of memory wastage in case of array.
Is This Answer Correct ? | 5 Yes | 2 No |
Answer / najirabanu
Array has fixed length but linked list is not have fixed
length if u store a number in array means it must have
memory space according to the number but in linked list not
neccessary memory space according to the number
In linked list one node that contain pointer,that denoted
as addrs of another node
In array should not contain addrs of another node
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / deenadhayalan.t
array is nothing but collection of similar data type.
list is a collection of different data type..
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / indiargukt
For fixed length linked lists are better rather than arrays.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / bhaskar diwakar
Linked list->1.insertion & Deletion is very easy compare to
Array.
2.only Sequential Searching Allow
3.Dynamic memory allocation
4.collection of non homogenous data
Array->use to both sequential & non sequential
searching(binary search)
2.collection of homogenous data
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / prabhjot singh
array is easy to understand bt linked list -very difficult .
Is This Answer Correct ? | 15 Yes | 15 No |
Answer / vky
Some of the above mention answer is nice, i would like to add some more points
Array had certain disadvantages as data storage, in an unordered array, searching is slow ,whereas in ordered array insertion is slow,In both kind of array deletion is slow
but in the case of link list it becomes very simple, like if we have to insert a new number create a new object of list and change the pointing reference
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / manikandan.s
Array is a collection of similar data-items and stored in sequence order with fixed size of memory.
But lined list contains collection of node. Each node link between other node and pointer is used to identify the position. Node consists of element and address of next element.
Is This Answer Correct ? | 0 Yes | 0 No |
main() { int i; printf("%d",((i=1)*i-- - --i*(i=-3)*i++ + ++i)); } ans is 24 bt how?pls tell smbody............
Hi can anyone tell what is a start up code?
Write the following function in C. stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.
a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f
struct abc { unsigned int a; char b; float r; }; struct xyz { int u; struct abc tt; }ww; ww = (struct xyz*)malloc(sizeof(struct xyz)); will the memory be allocated for the inner structure also?
Why data types in all programming languages have some range? Why ritche have disigned first time likethat?Why not a single data type can support all other types?
How can I read a directory in a C program?
2 Answers Bright Outdoor, Wipro,
What is the difference between c &c++?
15.what is the disadvantage of using macros? 16.what is the self-referential structure? 17.can a union be self-referenced? 18.What is a pointer? 19.What is the Lvalue and Rvalue? 20.what is the difference between these initializations? 21.Char a[]=”string”; 22.Char *p=”literal”; 23.Does *p++ increment p, or what it points to?
program to find error in linklist.(i.e find whether any node point wrongly to previous nodes instead of next node)
main() { int i = -3,j=2,k=0,m; m= ++i || ++j && ++k; printf("%d%d%d",i,j,k,m); }
Explain c preprocessor?