Concept explainers
Create class Test in a file named Test.java. This class contains a main
performs the following actions:
-
Instantiate a doubly linked list.
-
Insert strings “a”, “b”, and “c” at the head of the list using three Insert() operations. The state of the list is now [“c”, “b”, “a”].
-
Set the current element to the second-to-last element with a call to Tail() followed by a call to Previous()Then insert string “d”. The state of the list is now [“c”, “d”, “b”, “a”].
-
Set the current element to past-the-end with a call to Tail() followed by a call to Next(). Then insert string “e”. The state of the list is now [“c”, “d”, “b”, “a”, “e”] .
-
Print the list with a call to Print() and verify that the state of the list is correct.
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
- A loop that iteratively processes a given list is called a for construct. So long as there are things to process, it will keep running. To what extent is this statement accurate or false?arrow_forwardYou are going to implement a program that creates an unsorted list by using a linked list implemented by yourself. NOT allowed to use LinkedList class or any other classes that offers list functions. It is REQUIRED to use an ItemType class and a NodeType struct to solve this homework. The “data.txt” file has three lines of data 100, 110, 120, 130, 140, 150, 160 100, 130, 160 1@0, 2@3, 3@END You need to 1. create an empty unsorted list 2. add the numbers from the first line to list using putItem() function. Then print all the current keys to command line in one line using printAll(). 3. delete the numbers given by the second line in the list by using deleteItem() function. Then print all the current keys to command line in one line using printAll().. 4. putItem () the numbers in the third line of the data file to the corresponding location in the list. For example, 1@0 means adding number 1 at position 0 of the list. Then print all the current keys to command line in one…arrow_forwardCode NOT working. What to do? Here is code: appleList = [["Apple",52,14,0,0],["McIntosh red",80,18,0,0.5],["Gala (Apple)",52,11.4,0.2,0.3],["Fuji Apple",52,11.4,0.2,0.3],["Honey Crisp Apples",90,21,0,0],["Granny Smith Apples",52,11.4,0.2,0.3],["Red Delicious Apples",80,17,0,0],["Braeburn Apples",71.7,16,0.5,0.1],["Golden Delicious Apples",130,29,1,0],["Jonagold",130.7,34,1,0],["Cripps Pink Apple",80,18,0,0],["Empire Apples",80,17,0,0],["Produce Cortland Apples",70,6,1,5],["Jazz Apples",53.8,12,0.6,0.5],["Cameo Apples", 80,22,0,0]["Winesap Apples",80,22,0,0],["Rome Apples",80,22,0,0],["Ambrosia Apples",90,17,0.4,0],] print(":Type of Apple : Calories : Carbs (in GRAMS) : Protein (in GRAMS) : Fat (in GRAMS) :") for item in appleList:print(":",item[0]," "*(9-len(item[0])),":",item[1]," "*(13-len(item[1])),":",item[2]," "*(4-len(str(item[2]))),":")arrow_forward
- Computer Science Client Number Address Zipcode 123 ABC 11111 124 ABD 11112 125 ABE 11114 126 ABF 11115 I have been able to export the file to python and convert it to dataframe. DataFrama being "df". How can I write an argument, where if a Zipcode is outside of a list [11111,11112,11113,11114] then it is a red flag. Thank you!arrow_forwardThe following program reads a comma separated value (CSV) file of student grades. Each line of the file contains two values: the student ID and the grade. For example ID534240025, A- Complete the following loop that reads the file and extracts the two values into the variables student and grade. infile = open("studentList.csv") for line in infile: line line.strip() student, grade = =arrow_forwardSelect all answers that apply. In which of the following scenarios is using a vector less efficient than using a list? O A program that frequently needs to access elements throughout the the container O A program that needs to add a large number of elements to the beginning of the container A program that adds a fixed number of elements and then repeatedly removes the first element O A program that frequently adds elements, but only to the end of the containerarrow_forward
- 1. Write a program which:• creates a new Array List• adds 5 decimal numbers to it• prints the list to the screen2. In the same program, insert an element in the above ArrayList at index 2. The resulting Array Listmust be one element larger. Print the resulting list to the screen.3. In the same program, replace the element in the ArrayList at index 2 by null. Print the resulting list tothe screen.4. In the same program, remove the element at the last index of the Array List. Print the resulting list tothe screen.5. In the same program, use a 'for' loop to print each element of the Array List to the screen.6. Create a class named ArrayListManager. Into this class, code a method which prints to the screenevery element of an Array List of strings placed at an odd index. Hint: use a modulus.arrow_forward1. The codewords will be scrambled words. You will read the words used for the codes from a file and store it into an array. There are 60 words in the file that range in size from 3 characters to 7 characters. The file is called wordlist.txt and can be found attached to the assignment in IvyLearn.2. Start with input for an integer seed for the random number generator. There is no need to put a prompt before the cin operation.3. Ask the Player if they are ready to play and only proceed if they type a Y or y. If the user types an N or n then the program should finish. a. INPUT VALIDATION: Make sure the user has typed either y, Y, n, or N4. Create a variable to keep track of the number of guesses the user has made.5. Use the random number generator to pick a word from the list of words.6. Once you have chosen a word as the codeword you will need to scramble the letters to make it into a code. You should use the random number generator to help you mix up the letters.7. Display to the user…arrow_forwardImplement a function void printAll(void) to print all the items of the list.arrow_forward
- helparrow_forwardSuppose names is an ABList containing 10 elements. The call names.add(0, "George") results in: A. an exception being thrown. B. a 10-element list with "George" as the first element. C. an 11-element list with "George" as the first element. D. a single element list containing "George". E. None of these is correct.arrow_forwardis an ordered set which consists of fixed number of Elements. a. Queue O b. Array O c. List o d. Stackarrow_forward
- 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