Data structure and Algorithyms
Linked Lists A linked list consists of nodes with some sort of data, and a pointer, or link, to the next node. A big benefit with using linked lists is that nodes are stored wherever there is free space in memory, the nodes do not have to be stored contiguously right after each other like elements are stored in arrays. Another nice thing with linked lists is that when adding or removing nodes, the rest of the nodes in the list do not have to be shifted. Types of Linked Lists There are three basic forms of linked lists: Singly linked lists Doubly linked lists Circular linked lists A singly linked list is the simplest kind of linked lists. It takes up less space in memory because each node has only one address to the next node, like in the image below. A doubly linked list has nodes with addresses to both the previous and the next node, like in the image below, and therefore takes up more memory. But doubly linked lists are good if you want to be able to mov...