Beruflich Dokumente
Kultur Dokumente
:-from point of access strategy it is linear and from point of storage strategy it is non linear
Sumit Thokal
51 Yes
11 No
Re: what is the difference between arrays and linked list Answer #2
Array is a simple sequence of numbers which are not concerned about eachothers positions. they are independent of each-others positions. adding,removing or modifying any array element is very easy.Compared to arrays ,linked list is a comlicated sequence of numbers.each number in the linked list is connected to its previous & next no. via a link which is nothieng but a pointer.Addition,removal of no.s in linked list is related to this pointer direction & linking that no. to the no. which is already present in the list.
Kshama
14 No
Re: what is the difference between arrays and linked list Answer #3
In arrays v cant delete elements in middle but in Linked list v can do this.
Anu
32 No
Re: what is the difference between arrays and linked list Answer #4
>Array is a simple sequence of numbers which are not >concerned about eachothers positions. This is not true, what about arrays of objects ? They may be concerned about each other in some way. >adding,removing or modifying any array element is very >easy. This is untrue also, adding, removing elements in array is significantly more complex than removing or adding elements in linked list. This is because removing elements from array causes all elements after it to be shifted back, whereas with linked list, its merely traversing the list to find the node, previous node, and the next node and setting pointers, and inserting element into array will probably call for 1) resizing the whole array size (ie. assingning
Jaroosh
a new, bigger memory chunk for it) 2) copying elements from the former smaller array to the new - bigger one. This is a huge trade off, provided that in list, its simply matter of setting the NEXT pointer of one of the nodes. Main differences between the two are: 1) arrays are RANDOM ACCESS structures, where you can access elements in random/indexed manner, whereas list is a sequential access structure. This makes such algorithms like heap sort or binary search to work much faster on arrays 2) arrays are static/fixed size whereas lists are dynamic size structures. It means that when creating an array (both on stack or heap), you HAVE to specify its size. With lists, you just create an empty list and freely expand it 3) array consist of continuous chunks of memory, ie. nth element is at the memory location of : address_of_array + sizeof(array_element_type) * n this always holds true, that is why following will always work : for(int i=0;i < ARRAY_SIZE; i++) cout << *(array++); List is a sequence of nodes, connected by NEXT pointers, so consequent nodes may lie
WHEREVER in memory
Re: what is the difference between arrays and linked list Answer #5
the main differance between arrays and linked list is: In array we follow static memory allocation. i.e we assign memory to the particular element in advance. in linked list -> dynamic memory allocation. i.e we assign memory to the particular element at run-time.. hence we reserve only the amount of memory which is required. there is no problem of memory shortage or wastage, in linked list. which we very frequently come accross in the arrays..
Shruti
Re: what is the difference between arrays and linked list Answer #6
Both are nothing but the data structures where in arrays data can be accessed using subscript but in linked list data can be accessed by the pointer present in its previous
Yoga
node...
Re: what is the difference between arrays and linked list Answer #7
in a linked list data are accessed by a means of pointer WHILE linear array accessed by a means of subcript insertion, deletion is very easy with linear array while in a linked list is a little bits complex
Mesole
Re: what is the difference between arrays and linked list Answer #8
an array is changable length.a list does not.
Harikrishnan
Re: what is the difference between arrays and linked list Answer #9
1.array is fixed length and Array is a simple sequence of numbers which are not concerned about eachothers positions but linked list is variable length 2.in array values are accessing easy but linked list is some time taken process bcoz search aither forword or backword 3.in array updating operations are time taken
Vasu Kanneganti
Re: what is the difference between arrays and linked list Answer # 10
the main difference is that in array data is not linked to each other but in linked lists data is connected to each other as every node is connected to previous node.
Bhumika Garg
Re: what is the difference between arrays and linked list Answer # 11
All elements of array stored in contiguous memory location. While in case of linked list each node does not stored in contiguous memory location
Priya
Re: what is the difference between arrays and linked list Answer # 12
1)Array has a static storage where as in linked list it is dynamic. 2)To add some elements in an array is impossible since the size is predefined.For the same case we can add elements at the beginning,in the
Soumen Goswami
middle and also in the end. 3)To access the data from array is very easy while to access data from linked list is some complex.
Re: what is the difference between arrays and linked list Answer # 13
In array,memory is managed randomly... but, in linked list memory is managed in a heap concept..
Shweta
Re: what is the difference between arrays and linked list Answer # 14
array is easy to understand bt linked list -very difficult .
Prabhjot Singh
Re: what is the difference between arrays and linked list Answer # 15
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 (cant increase the size) 2.Most likely not enough or too much memory (you never know
Durairaj
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 doesnt have those. So based on what youve 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.
Re: what is the difference between arrays and linked list Answer # 16
array for one type of data ( like int array , char array ) memory should be kept in track and managed by the user. linked list for multiple type of data
Karthikeyan
Re: what is the difference between arrays and linked list Answer # 17
arrays: staticaly allocating memory easy to traverse memory wastage linked list:runtime allocation difficult to traverse efficient usag of memory
Thanu
Re: what is the difference between arrays and linked list Answer # 18
arrey is very fast in linked list.
Mehdin
Arrays and Linked list both are list data structures used for maintaining a list of values. Arrays use sequential allocation while Linked list uses linked allocation. > Linked list uses some extra memory i.e. link pointer. > Indexing an element, e.g. accessing kth element is cheaper in arrays and costly in Linked list.> Insertion and Deletion of elements is a cheaper operation in Linked lists.> Since nodes in Linked list are dynamically allocated, it has no limitations on growth (apart from memory constraints). > Merging Lists is easier in case of Linked lists. > Breaking a List into two or more lists is easier in case of Linked lists.so Linked list is a better data structure in most cases. Arrays are goos mostly for static data structures.
Above answer was rated as good by the following members:
lkaur November 06, 2006 06:51:16
mahesh
arrays cannot be expanded or increased so we use linked list for dynamic data storage
shekhar
RE: What are the differences between Arrays and Linked... For example:: We want to delete some elements from array then either we have to place zero or we need to rearrange it. For dynamic deletion and insertion linked list is used instead arrays. But if we do not need these operations then using arrays is sufficient and easier too.
rathnam
RE: What are the differences between Arrays and Linked... space/time trade-off are the parameters to differentiate between them. Space: In the case of Arrays: for storing 10 elements we need only 10* sizeof(element) bytes. In the case of Lists: for storing 10 elements we need at least 10*(sizeof(element)+sizeof(int*)); so we need more space in the case of linked lists to store the same data when compared to lists. > Arrays are better; Time: In the case of Array indexing is possible so it takes constant time to access a particular data item. But where as in the case of lists random access is not possible it takes variable amount of time to access a particular data item. > Arrays are better. Misselleneous: 1) Some data structures can be represented easily with linked lists when compared to arrays. 2) Addition and Deletion is easier in the case of lists. 3) making a copy is easier in the case of Arrays because the memory is contigeous.
Manoj
Arrays and Linked list both are list data structures used for maintaining a list of values. Arrays use sequential allocation while Linked list uses linked allocation. > Linked list uses some extra memory i.e. link pointer. > Indexing an element e.g. accessing kth element is cheaper in arrays and costly in Linked list.> Insertion and Deletion of elements is a cheaper operation in Linked lists.> Since nodes in Linked list are dynamically allocated it has no limitations on growth (apart from memory constraints). > Merging Lists is easier in case of Linked lists. > Breaking a List into two or more lists is easier in case of Linked lists.so Linked list is a better data structure in most cases. Arrays are goos mostly for static data structures.
Overall Rating: +1
All the above statements reveal that link list is of better data structure than that of Array.But if we want to perform Sorting ( Ex: Bubble Sort Insertion Sort Quick Sort) by means of Link List then the time complexity will be much more than that of implementing the same with an Array
sumit.manchanda
Arrays are stored in contigious memory ie (if suppose arr[12] is an integer array containing 12 elemnts if memory address ist elemnt is say 1088 then memoy address of next element in array would be 1090 & the next memory address would be 1092 as size of an integer value is 2 bytes) where as in linked lists it is not the case. In linked lists elements are not store contigious memory allocations in linklists every node contins a pointer which contains the address of next node in linked
Storage: 1) Arrays are statically allocated whereas linked list are dynamically allocated and linked.Generally, if the number of allocations are known before hand, we use arrays. Otherwise linked list Performance: 2) Array is a high performance way of storing a group of data because each element is laid out next to it's neighbor in memory. This allows for very fast access because (a) the code can do a little math and jump quickly to any location in the array, and (b) the elements are all grouped together so they tend to be in memory at the same time (fewer page faults and cache misses).
3) If you want to index by something like a string, you could use a hash table. Lets say you have a list of players, and you want to pull an object up from each player's name. You take the string, run a hash functi to convert that into a number that falls within the range of an array, and store it in that element.
Or, you can have a linked list faster by breaking it into subelements. For example, if you were storing wor a dictionary, you could have an array of linked lists with 26 entries for a-z. That way when you manipulat list, you are manipulating a much smaller subset. Thanks
Suresh Said..
According to me Arrays can't declared dynamically.i.e they can't allocate memory dynamically. when ever we w to add more eliments than the size of Array it is not possible.
In the case of Linked lists we can dynamically create any no of nodes and insert them at any point.And deletion o eliments,insert eliment in the middle is also more easy here.
Not only that If we want to store 10 eliments,inarrays we need 10*(Size of datatype) bytes contiguous memory locations. But in Linked lists there is no need of contiguous memory locations.
But both have their own features,and disadvantages, at that time situation we should have deside which one fullf our applications. ThankU
Arrays are stored in contigious memory ie (if suppose arr[12] is an integer array containing 12 elemnts, if memor address of ist elemnt is say 1088 then memory address of next element in array would be 1090 & the next memo address would be 1092 as size of an integer value is 2 bytes) whereas in linked lists it is not the case. In linked elements are not stored in contigious memory allocations, in linklists every node contins a pointer which contai the address of next node in linked list.
Said.. nice
poo