111111 File: useArraysAndLinkedNodes.py Author: Derrf, Seitz This program exercises arrays and linked nodes. The following files...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
111111 File: useArraysAndLinkedNodes.py Author: Derrf, Seitz This program exercises arrays and linked nodes. The following files must be in the same folder: arrays.py node.py www. <your name> #Replace <your name> with your name. #Replace any "<your code>" comments with your own code statement (s) # to accomplish the specified task. # DO NOT CHANGE ANY OTHER CODE. from arrays import Array from node import Node # Part 1: #This function prints a linked list of nodes. # Parameters: head a reference to the first node in the linked list. def printLinkedList (head): #Print the linked list with each nodes's data on a separate line. # You must use some form of a loop to print the linked list. #<your code> # Here is the array: theArray - Array (10) for i in range (len (theArray)) : theArray[i] = 1 + 1 # Print the array: print ("The array:") print (theArray) print () # blank line #Here is the array: theArray Array (10) for i in range (len (theArray)) : theArray[i]=i+1 #Print the array: print ("The array:") print (theArray) print () # blank line- # You must use these variables in your code: Node (theArray [0], None). head tail = head # Part 2: # Copy the array items to a linked list of nodes: # The linked list must consist of Node class items. # You must use some form of a loop to create the linked list. #<your code> print ("After creating the list from the array items:") printLinkedList (head) print () # blank line. # Part 3: # Add a node with the value 99 to the end of the list: #<your code> print ("After adding 99 to the end of the list: ") printLinkedList (head) print () # blank line. # Part 4: # Add a node with the value 55 after the node with the value 5: # You must go through the list until you arrive at the 5, #then link in the new node correctly. #<your code> print ("After adding 55 after the node with the value 5:") printLinkedList (head) 111111 File: useArraysAndLinkedNodes.py Author: Derrf, Seitz This program exercises arrays and linked nodes. The following files must be in the same folder: arrays.py node.py www. <your name> #Replace <your name> with your name. #Replace any "<your code>" comments with your own code statement (s) # to accomplish the specified task. # DO NOT CHANGE ANY OTHER CODE. from arrays import Array from node import Node # Part 1: #This function prints a linked list of nodes. # Parameters: head a reference to the first node in the linked list. def printLinkedList (head): #Print the linked list with each nodes's data on a separate line. # You must use some form of a loop to print the linked list. #<your code> # Here is the array: theArray - Array (10) for i in range (len (theArray)) : theArray[i] = 1 + 1 # Print the array: print ("The array:") print (theArray) print () # blank line #Here is the array: theArray Array (10) for i in range (len (theArray)) : theArray[i]=i+1 #Print the array: print ("The array:") print (theArray) print () # blank line- # You must use these variables in your code: Node (theArray [0], None). head tail = head # Part 2: # Copy the array items to a linked list of nodes: # The linked list must consist of Node class items. # You must use some form of a loop to create the linked list. #<your code> print ("After creating the list from the array items:") printLinkedList (head) print () # blank line. # Part 3: # Add a node with the value 99 to the end of the list: #<your code> print ("After adding 99 to the end of the list: ") printLinkedList (head) print () # blank line. # Part 4: # Add a node with the value 55 after the node with the value 5: # You must go through the list until you arrive at the 5, #then link in the new node correctly. #<your code> print ("After adding 55 after the node with the value 5:") printLinkedList (head)
Expert Answer:
Answer rating: 100% (QA)
Program Screenshot for Indentation Reference Sample Output Program code to copy File useArraysAndLinkedNodespyAuthor Derrf Seitz This program exercise... View the full answer
Related Book For
Business Statistics For Contemporary Decision Making
ISBN: 978-1118749647
8th edition
Authors: Black Ken
Posted Date:
Students also viewed these accounting questions
-
On Monday you invested $210 in Grouper Ltd. Grouper has earned daily returns of -9.0 percent , 19.0 percent, -31.0 percent, 7.0 percent, 6.0 percent and -6.0 percent. What is the value of your...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
A Styrofoam slab has thickness h and density ps. When a swimmer of mass m is resting on it, the slab floats in fresh water with its top at the same level as the water surface. Find the area of the...
-
Describe the money management activities of a portfolio manager who believes that the market is efficient.
-
A piston/cylinder arrangement contains water of quality x = 0.7 in the initial volume of 0.1 m3, where the piston applies a constant pressure of 200 kPa. The system is now heated to a final...
-
Martin Kline, engagement partner for RCT Manufacturing Company, a February 28, 1999, year end client, is performing analytical procedures to better understand RCT's business and to determine where...
-
Alcide Mining Company purchased land on February 1, 2014, at a cost of $1,190,000. It estimated that a total of 60,000 tons of mineral was available for mining. After it has removed all the natural...
-
Locate an area that has at least four meters of smooth, level surface. This area could be a tile, linoleum, or smooth concrete surface. Avoid carpeted areas if possible. If you are doing this...
-
On March 10, 2006, Nortel Networks Corp. announced that it would delay filing its 2005 financial reports with the SEC. The delay arose because Nortel and its auditors decided that certain revenue...
-
Mission Bay Sales, inc., accounts for its installment sales using the installment method of accounting. Periodic inventory system is used. The balances in the accounts for deferred interest and...
-
Can government assignment and enforcement of property rights internalize an externality? Will this approach work as well as, better than, or worse than direct government intervention? Explain your...
-
How do you express emotion when communicating with various forms of technology covered in this chapter?
-
The rise of apps such as Uber and Lyft has generated considerable debate among policy makers and politicians in major urban areas over whether these services are net harmful or beneficial. The debate...
-
Discuss an example of a time when you misunderstood another person in a text message, an email, or an instant message. How did you respond to the misunderstanding? Did you and the other person clear...
-
Find an example of how your workplace or school practices written communication with you personally (e.g., course syllabus, job orientation newsletter). Is the overall message easy to read and...
-
Sales representatives in your firm each have specific clients, and they earn 3% commission if they reach their quarterly sales goals plus an additional 1% for each 20% by which they exceed the goal....
-
QUESTION 2 The CEO of Farisha Hijab Sdn Bhd insisted on further investigation to be carried out that he also required Mr Muaz to conduct the analysis of variance for the material and labour of the...
-
Commercial fish raising is a growing industry in the United States. What makes fish raised commercially grow faster and larger? Suppose that a fish industry study is conducted over the three summer...
-
One study on managers satisfaction with management tools reveals that 59% of all managers use self-directed work teams as a management tool. Suppose 70 managers selected randomly in the United States...
-
A research organization selected 50 U.S. towns with Census 2010 populations between 4000 and 6000 as a sample to represent small towns for survey purposes. The populations of these towns follow....
-
Try to identify the class in the stable design pattern for culture.
-
Try to connect those classes together to form a class diagram.
-
Consider a scenario where your laptop has stopped working and you take it to a repair center. The vendor asks for a huge sum of money, but you negotiate with him the price for repair. Create a class...
Study smarter with the SolutionInn App