Linked Lists

Linked Lists are data structures that are similar to arrays but are not stored in contiguous memory. Linked Lists use pointers to access the next node. Logically a linked list looks like, Each node has two variables, first variable stores the data value and the second variable is a pointer variable that points to the next node in the linked list. Arrays have O(n) Insertion operation and O(n) deletion operation [at the first position], whereas in Linked Lists these operations are O(1). However, we cannot access a linked list element directly like in array using index. Instead we have to parse through a linked list sequentially using pointers. Also, array size is fixed whereas linked lists are expandable. Linked lists also consume extra space because of pointer. We can create a Linked List in C++ by defining a structure for node as : struct LLNode { int data; struct LLNode * pointer; // pointer that points to...