Skip to main content

Posts

Showing posts with the label data structure

Linked List - Data Structure

Linked List A linked list is a linear data structure that does not store elements in contiguous memory locations, the elements in the linked list are linked using pointers. It is a collection of nodes in which each node stores data and a pointer that links to the next node to form a sequence of nodes. -> Linked List is a linear data structure which is a combination of Nodes. -> Nodes contain two parts i.e. data & address. Representation of a Linked List in C: A linked list is represented as a pointer to the first node where each node contains: Data:  Here the actual information is stored. Next:  Pointer that links to the next node. Advantages of a Linked List: Linked list is dynamic data structure it has memory allocation and de-allocation, which means that memory is only used when needed and not earlier in order to avoid waste. In linked list items are arranged in a linear fashion, new items can be inserted or removed as and when needed without affecting other items...