Im mostly a C person, can anyone explain these to me and maybe give an example?
Printable View
Im mostly a C person, can anyone explain these to me and maybe give an example?
A linked list can be thought of as a train; you have a series of cars that all link together the same way, while in a linked list you have a series of "nodes", which can be thought of as a box with two pointers: one to a variable of arbitrary type, and the other to another node. The cars can contain anything you want; in an ideal linked list, each "node" can contain anything you want (string, int, Widget, etc.). You can separate two cars and insert another in between them; you can insert a new node in the middle of a linked list without disturbing the rest too much. You can search your train one car at a time until you find what you're looking for, same with the linked list. The train ends with a caboose; the last node has its "next" pointer set to null.
A good reference for these (and other data structures), as I just placed in another post (deja vu) is
http://www.brpreiss.com/books/opus4/html/book.html
...or just click the search button at the top of this page. There have been a whole lot of posts on this topic.