r/learnprogramming • • Jan 31 '14

Can someone ELI5 linked lists?

Part of my assignment for my online class involves linked lists and we don't really go over them. I looked around online and I'm slightly confused by all the explainations since I'm fairly new to programming. Can someone dumb it down for me?

77 Upvotes

85 comments sorted by

View all comments

Show parent comment

3

u/DestroyerOfWombs Jan 31 '14

If you don't know where the head node is, you don't know where your list is. In a singly linked list, if you don't have a head node you have lost all nodes before the one you do know the location of.

1

u/kqr Jan 31 '14

Sure, some part of the program knows where the head is, but not necessarily all parts of the program. Some parts might only know about a few elements.