
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question

Transcribed Image Text:**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 returns -1.
- **InsertNode(Data, Link, FreeNodes, newNode, 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, 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.
- **PrintLinkedList(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."

Transcribed Image Text:**Implementation Details:**
1. Be sure to include your name, along with the Certificate of Authenticity, as comments at the very beginning of your Python code. Also, if you collaborated with others, be sure to state their names as well.
2. Your program must validate user input, informing the user of invalid input data.
3. Your program should display the following menu (looping continuously until the user selects option E):
Enter the letter below that corresponds to the desired singly-linked list operation:
- A. Insert a new item (i.e., string) into the ordered singly-linked list.
- B. Delete a specified item (i.e., string) from the ordered singly-linked list.
- C. Print all items (i.e., strings) in the ordered singly-linked list.
- D. Print the contents of the following:
- Data array
- Link array
- FreeNodes array
- Value of headPtr
- E. End program.
**Note:** Your menu logic should accept options A, B, C, D, E (uppercase or lowercase). Anything other than these options should generate the following error message to the user.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 4 steps with 3 images

Knowledge Booster
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
- In python pleasearrow_forwardData structure and algorithms. DYNAMIC DATA STRUCTURE LINKED LIST. PURPOSE OF WORK : Consolidation of knowledge on the theoretical foundations of presentation of data in the form of links, classification of lists, learning to solve problems using the LIST standard template library in C++. Task : Write a program to process a linked list from the standard template library. Perform an individual task as a separate function. Implementation of automatic filling and display functions with random data in the program. The task is : The list is given. Create a function to calculate the arithmetic mean value of the elements of the list equal to the Fibonacci number.arrow_forwardC++ Code Use the following list to sort it and create a single linked list: 6,13,7,11,9,2,15,5,3,4,10,14 Also make a list of the available memory. Print the list out with the links. Now delete 11 from the list, adding its location to the available memory list, then add 1 and 8 to the list. When you add the 1 you should use the location of the deleted 11 to add 1 there. Add 8 to the next available spot on the available memory list. When you print the list, print out the logical list using the links and also print out physical list without the links to see what the real list looks like.arrow_forward
- Write a python program that takes two lists, merges thetwo lists, sorts the resulting list, and then finds the median of theelements in the two lists. You cannot use python build-in sort() function #todo#You can use math functions like math.floor to help the calculationimport math #todo#You can use math functions like math.floor to help the calculation import math def task7(list_in_1, list_in_2): # YOUR CODE HERE return median please use these variables no print function pleasearrow_forward-python- Write a function called get_words that takes a list of words and a letter,and returns a new list, which only contains the words that don't have the given letter in them. For example, get_words(["cat", "dog"], 'o') should return ["cat"] and get_words(["cat", "bat"], 'a') should return an empty list.arrow_forwardPYTHON!!! Write a function that will filter course grades that are stored in a list, creating and returning a new list. Your implementation must have the following rules: - The function must accept two (and only two) parameters: The first is: the maximum integer value for any grade to remain in the list (any value above the maximum will be filtered and removed from the list). The second is: the list of grades (you can assume the list contains only integer values) - The function must return a new list and not modify the existing list. - The function must use a list comprehension to filter the existing list and create the new list that is returned. - DO NOT USE THE: built-in-"filter" function.arrow_forward
- Lin in out 1283.arrow_forwardHelp make a C++ program that:1. Queries the user for the name of a file of text.2. Opens the file, and maintains two lists: one list for words beginning with the letter"D" or "d", and a second list for words beginning with any other letter. Each listmust maintain words in alphabetical order.3. Each node in the list must contain the word and the number of times that the word appears.4. Display (a screen at a time) each of the lists showing the alphabetized list of words and thenumber of times that each appears. Please have the main function as the first function in the program. Please make the least amount of functions as possible. Like for the file input have the file error thing in the same function. And please add comments throughout the code.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education