▶ LINKED LIST
Linked list is a list of nodes that are connected to each other.
Title: Linked List
Author: Noam Y.
OverviewLinked List (LL) is the solution to the problem of inserting or deleting items in a regular list. Instead of pulling all items that come after the deleted item, or pushing in case of insertion, each node in LL "knows" who are its previous and next nodes.
When searching in LL, the search starts at the saved root node and moves to the next linked nodes until the item is found. Insertion and deletion involves actions that mimic the actions on a real linked chain.
ImplementationThe program holds nodes data in appropriate lists, with names that describe their purpose. Each new node is designated a new id, so that the data of all nodes, whether exist or deleted, is maintained. Program also saves the current id numbers, so it can show the list. There are two show modes: ID, ORDER. In order by id, the current nodes are shown in ascending id order. In the ORDER mode, the list is shown by traversing from root to top.
ActionThe program picks the selected show mode, does some insertions and deletions, and shows the list for each operation.