What is a linked list?

Posts 1–4 of 4 · Page 1 of 1
What is a linked list?
Can someone explain me the difference between a LinkedList and an ArrayList?
They have the same functions?
Array list uses an array internally which is dynamically increased as you need it. (You don't see it happen)

On a Linked list, every "member" is pointing to the next one. So, when you add a new member, there's the head/start of the list pointing at it. When you add another member, the previous one (who had the head of the list pointing at it), will point at this new one... etc..etc..etc..
You dont need an array, yet they all are stored in order and all can be accessible.
There is also another kind of linked lists, such as double linked list. Also stack, queue, etc...

PS: Im pretty sure you can find a better explanation around the web, or someone posting here
I think its kinda clear. An arraylist pre-reserves additional empty spots. And with a linked list this isnt needed cause the last element points to a new memory adress with the added element?
Quote Originally Posted by AlphaDog209 View Post
I think its kinda clear. An arraylist pre-reserves additional empty spots. And with a linked list this isnt needed cause the last element points to a new memory adress with the added element?
pretty much, yes
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Talk with us