![]() (Adjacency list representation of Graph). ![]() Linked Lists can also be used to implement Graphs.Linked Lists can be used to implement Stacks, Queues.The last node will have no next node connected to it, so it will store a special value called NULL. The right part of the node contains a pointer to the next node (or address of the next node in sequence). The left part of the node which contains data may include a simple data type, an array, or a structure. Linked lists always maintain head and tail pointers so that insertion at either the head or tail of the list is a constant time operation.Īs we can see in the above image linked list in which every node contains two parts, an integer and a pointer to the next node. A data part that stores the element and a next part that stores the link to the next node. A node is a collection of two sub-elements or parts. Each node has at least a single pointer to the next node and in the last node’s case a null pointer representing that there are no more nodes in the linked list.Ī linked list, in simple terms, is a linear collection of data elements. Linked lists can be thought of from a high-level perspective as being a series of nodes.
0 Comments
Leave a Reply. |