REQUIREMENTS: 1. Using Python, you will write a program called singly-linked-list-arrays.py that implements an ordered singly-linked list using arrays. 2. The data items in your ordered singly-linked list will consist of first names. For example: Adam, Eve, Frank, Mark, Vanessa, etc. 3. Be sure to include the following linked list operations in your Python program: GetNode(FreeNodes) returns the index of the first available (free) node as indicated in the FreeNodes boolean array. If there are no available (free) nodes, then 4 returns-1. • InsertNode(Data, Link, FreeNodes, new Node, headPtr) inserts a newNode into the linked list, referenced by headPtr, as represented using the Data and Link arrays. The index of the corresponding FreeNode array element is assigned the value of False, indicating that this node is no longer considered "free." Returns +1 if successfully inserted into the list, otherwise returns -1. ▪ DeleteNode(Data, Link, FreeNodes, node ToDelete, headPtr) deletes the node ToDelete from the linked list, referenced by headPtr, as represented using the Data and Link arrays. The index of the corresponding FreeNode array element is assigned the value of True, indicating that this node is now considered "free." Returns +1 if successfully deleted, otherwise returns -1. ▪ SearchList(Data, Link, FreeNodes, findNode, headPtr) searches the linked list, referenced by headPtr and represented using the Data and Link arrays, for which the data value matches that of findNode. Returns the index value in the Data array of the found node. If the findNode item is not found, then the value -1 is returned. PrintLinked List (Data, Link, headPtr) prints the data values of all nodes in the singly-linked list, in order. If the linked list is empty, then prints "No items in the linked list."
Types of Linked List
A sequence of data elements connected through links is called a linked list (LL). The elements of a linked list are nodes containing data and a reference to the next node in the list. In a linked list, the elements are stored in a non-contiguous manner and the linear order in maintained by means of a pointer associated with each node in the list which is used to point to the subsequent node in the list.
Linked List
When a set of items is organized sequentially, it is termed as list. Linked list is a list whose order is given by links from one item to the next. It contains a link to the structure containing the next item so we can say that it is a completely different way to represent a list. In linked list, each structure of the list is known as node and it consists of two fields (one for containing the item and other one is for containing the next item address).
Step by step
Solved in 4 steps with 3 images