0

what is the difference between linked list and array list while operating

c use pointer then does java use the similar way to make the linked list

24th Jan 2017, 9:01 AM
Ralph Haides
Ralph Haides - avatar
2 Respostas
+ 1
You can also have a look at my codes. "Self implemented LinkedList" shows an example of a LinkedList implementation.
24th Jan 2017, 9:55 AM
bem
bem - avatar
0
All linked lists are based on pointers, a doubly-linked list has two pointers, one for the previous element and one for the next. So to find an element you have to go through the pointers which is a litte slow (linear time), but when you insert or delete an element you only change 2 pointers. This can be done in constant time which means it is very fast. An array list is basically a dynamic array, which means it can be indexed in constant time, but when it grows it uses memory copy operations when its buffer is full. This can take a lot of time.
24th Jan 2017, 9:20 AM
Niels Koomen
Niels Koomen - avatar