REQUIREMENTS: 1. 2. 3. Using Python, you will write a program called singly-linked-list-arrays.py that implements an ordered singly-linked list using arrays. The data items in your ordered singly-linked list will consist of first names. For example: Adam, Eve, Frank, Mark, Vanessa, etc. 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 returns - InsertNode(Data, Link, FreeNodes, new Node, head Ptr) 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. 1. DeleteNode(Data, Link, FreeNodes, nodeToDelete, headPtr) deletes the nodeToDelete 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."

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Only the simple algorithm please.
## Requirements

1. Using Python, write a program called `singly-linked-list-arrays.py` to implement an ordered singly-linked list using arrays.
2. The data items in your ordered singly-linked list will consist of first names, e.g., Adam, Eve, Frank, Mark, Vanessa.
3. Include these linked list operations in your Python program:

   - **GetNode(FreeNodes)**: Returns the index of the first available (free) node in the `FreeNodes` boolean array. If no free nodes are available, returns -1.
   - **InsertNode(Data, Link, FreeNodes, newNode, headPtr)**: Inserts a `newNode` into the linked list, using the `Data` and `Link` arrays. Marks the corresponding `FreeNode` as `False`. Returns +1 if successful, otherwise -1.
   - **DeleteNode(Data, Link, FreeNodes, nodeToDelete, headPtr)**: Deletes `nodeToDelete` from the linked list. Marks the corresponding `FreeNode` as `True`. Returns +1 if successful, otherwise -1.
   - **SearchList(Data, Link, FreeNodes, findNode, headPtr)**: Searches for `findNode`. Returns the index in the `Data` array if found, otherwise returns -1.
   - **PrintLinkedList(Data, Link, headPtr)**: Prints the data values of all nodes in order. Prints "No items in the linked list" if empty.

## Implementation Details

1. Include your name and a Certificate of Authenticity as comments at the beginning of your code. Mention any collaborators.
2. Validate user input to inform them of invalid data.
3. Display the following menu (looping until the user selects option E):

   - A. Insert a new item (i.e., string).
   - B. Delete a specified item (i.e., string).
   - C. Print all items (i.e., strings).
   - D. Print the contents of the:
     - Data array
     - Link array
     - FreeNodes array
     - Value of `headPtr`
   - E. End program.

**Note**: Accept options A, B, C, D, E (uppercase or lowercase). Invalid entries should display:

"Invalid option! Please enter A, B, C, D or E."
Transcribed Image Text:## Requirements 1. Using Python, write a program called `singly-linked-list-arrays.py` to implement an ordered singly-linked list using arrays. 2. The data items in your ordered singly-linked list will consist of first names, e.g., Adam, Eve, Frank, Mark, Vanessa. 3. Include these linked list operations in your Python program: - **GetNode(FreeNodes)**: Returns the index of the first available (free) node in the `FreeNodes` boolean array. If no free nodes are available, returns -1. - **InsertNode(Data, Link, FreeNodes, newNode, headPtr)**: Inserts a `newNode` into the linked list, using the `Data` and `Link` arrays. Marks the corresponding `FreeNode` as `False`. Returns +1 if successful, otherwise -1. - **DeleteNode(Data, Link, FreeNodes, nodeToDelete, headPtr)**: Deletes `nodeToDelete` from the linked list. Marks the corresponding `FreeNode` as `True`. Returns +1 if successful, otherwise -1. - **SearchList(Data, Link, FreeNodes, findNode, headPtr)**: Searches for `findNode`. Returns the index in the `Data` array if found, otherwise returns -1. - **PrintLinkedList(Data, Link, headPtr)**: Prints the data values of all nodes in order. Prints "No items in the linked list" if empty. ## Implementation Details 1. Include your name and a Certificate of Authenticity as comments at the beginning of your code. Mention any collaborators. 2. Validate user input to inform them of invalid data. 3. Display the following menu (looping until the user selects option E): - A. Insert a new item (i.e., string). - B. Delete a specified item (i.e., string). - C. Print all items (i.e., strings). - D. Print the contents of the: - Data array - Link array - FreeNodes array - Value of `headPtr` - E. End program. **Note**: Accept options A, B, C, D, E (uppercase or lowercase). Invalid entries should display: "Invalid option! Please enter A, B, C, D or E."
Expert Solution
Step 1

Algorithm:-

The algorithm is defined as a set of steps to perform a specific task.

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Lists
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education