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 |
IS STRUCTURES CAN BE USED WITHIN AN ARRAY?
program to print upper & lower triangle of a matrix
Write a c program to find, no of occurance of a given word in a file. The word is case sensitive.
Write a program to remove the C comments(/* */) and C++ comments(//) from a file. The file should be declared in command line.
How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?
#include<stdio.h> { printf("Hello"); } how compile time affects when we add additional header file <conio.h>.
Differentiate fundamental data types and derived data types in C.
What are structure types in C?
Can a void pointer point to a function?
What should malloc() do?
What is wrong with this code such that it doesnt produce the input reversed? #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { char Space = ' '; char LineOfText; float count; LineOfText = getchar(); while ((LineOfText = getchar()) != '/n'); { count = strlen(LineOfText) - 1; while (count >= 0) { putchar(LineOfText[count]); count--; } } getchar(); return 0; }
What is "Hungarian Notation"?