Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question
Python Please!! Thank you !!
### REQUIREMENTS:

1. **Objective**: Write a Python program called `singly-linked-list-arrays.py` to implement an ordered singly-linked list using arrays.
2. **Data Elements**: These will consist of first names like Adam, Eve, Frank, Mark, Vanessa, etc.
3. **Operations to Implement**:
   - **GetNode(FreeNodes)**: Finds the index of the first available node as indicated in the `FreeNodes` boolean array. Returns -1 if unavailable.
   - **InsertNode(Data, Link, FreeNodes, newNode, headPtr)**: Inserts `newNode` into the list at the position indicated by `headPtr`. Updates the corresponding `FreeNode` index to `False` after insertion. Returns +1 on success, -1 on failure.
   - **DeleteNode(Data, Link, FreeNodes, nodeToDelete, headPtr)**: Deletes `nodeToDelete` from the list, updating `FreeNode` to `True`. Returns +1 if successful, otherwise -1.
   - **SearchList(Data, Link, FreeNodes, findNode, headPtr)**: Searches for `findNode` in the list and returns its data array index. Returns -1 if not found.
   - **PrintLinkedList(Data, Link, headPtr)**: Prints all node data values in order. Prints "No items in the linked list" if empty.

### IMPLEMENTATION DETAILS:

1. **Documentation**: Include your name and a Certificate of Authenticity in the code comments. Acknowledge contributors.
2. **Input Validation**: Ensure the program informs users of invalid inputs.
3. **User Menu**:
   - **A**: Insert a new item.
   - **B**: Delete a specified item.
   - **C**: Print all items.
   - **D**: Print the contents of data, link, FreeNodes arrays, and `headPtr`.
   - **E**: End program.

**Instructions**: Accept inputs A, B, C, D, E (case insensitive). Display the error message for invalid options:

```
Invalid option! Please enter A, B, C, D or E.
```
expand button
Transcribed Image Text:### REQUIREMENTS: 1. **Objective**: Write a Python program called `singly-linked-list-arrays.py` to implement an ordered singly-linked list using arrays. 2. **Data Elements**: These will consist of first names like Adam, Eve, Frank, Mark, Vanessa, etc. 3. **Operations to Implement**: - **GetNode(FreeNodes)**: Finds the index of the first available node as indicated in the `FreeNodes` boolean array. Returns -1 if unavailable. - **InsertNode(Data, Link, FreeNodes, newNode, headPtr)**: Inserts `newNode` into the list at the position indicated by `headPtr`. Updates the corresponding `FreeNode` index to `False` after insertion. Returns +1 on success, -1 on failure. - **DeleteNode(Data, Link, FreeNodes, nodeToDelete, headPtr)**: Deletes `nodeToDelete` from the list, updating `FreeNode` to `True`. Returns +1 if successful, otherwise -1. - **SearchList(Data, Link, FreeNodes, findNode, headPtr)**: Searches for `findNode` in the list and returns its data array index. Returns -1 if not found. - **PrintLinkedList(Data, Link, headPtr)**: Prints all node data values in order. Prints "No items in the linked list" if empty. ### IMPLEMENTATION DETAILS: 1. **Documentation**: Include your name and a Certificate of Authenticity in the code comments. Acknowledge contributors. 2. **Input Validation**: Ensure the program informs users of invalid inputs. 3. **User Menu**: - **A**: Insert a new item. - **B**: Delete a specified item. - **C**: Print all items. - **D**: Print the contents of data, link, FreeNodes arrays, and `headPtr`. - **E**: End program. **Instructions**: Accept inputs A, B, C, D, E (case insensitive). Display the error message for invalid options: ``` Invalid option! Please enter A, B, C, D or E. ```
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education