Question: Create our own linked list class Data Structure our instructor sends this : import java.io.File; import java.util.Scanner; import java.io.FileNotFoundException; //This class demonstrates reading a text
"Create our own linked list class"
Data Structure

our instructor sends this :
import java.io.File; import java.util.Scanner; import java.io.FileNotFoundException; //This class demonstrates reading a text file and storing them into an array /* In this program 1. Read data from a file save it in array AllFile 2. Read one string at a time from ALLFile a. If the string is double or int i. Save a new entry in arrays dataType, dataName , and dataValue b. If the string is + operator/sign i. Read the values for the mathematical equation and update the values ii. You need to read the value of the operand before + sign - If it is operand x, y, or ect, convert the value to a string - If it is integer, use it as it is. iii. Repeat the same steps for the operand after the + sign iv. Find what is the operand before the = sign v. Updates its value with the new sum */ //This class demonstrates reading a text file and storing them into an array public class ReadFileIntoArray { public static void main(String[] args) { int i = 0; try { String[] words = new String[5000]; //Assuming the input file has max size of 5000 words Scanner input = new Scanner(System.in); //Scanner object for keyboard input System.out.print( "Enter the filename: " ); // Prompt the user for a file name String fileName = input.nextLine(); // get a file name from the user //If the full path is not given, then the file must be on the same folder as the source java file. //Otherwise, the user must give the full path File inputFile = new File( fileName ); // create a File object //Another Scanner object for file input Scanner fileInput = new Scanner(inputFile); while (fileInput.hasNext()) //Read from file as long as you have strings { words[i] = fileInput.next(); //Read a single string and store it in the array i++; } //Verify that you have the words stored in the array for (i = 0; i Q1. [15 pts] Write a Java program that reads a file (one line, 10 words) of your shopping list then builds two data structures an array and a single linked list. After the array and linked list are built, display them on the monitor What is the space complexity of each data structure? Compare the time complexity to build, insert a new item at the end of the data structure, delete an item, and find an item in each data structure Which data structure would you prefer to use and why? Q1. [15 pts] Write a Java program that reads a file (one line, 10 words) of your shopping list then builds two data structures an array and a single linked list. After the array and linked list are built, display them on the monitor What is the space complexity of each data structure? Compare the time complexity to build, insert a new item at the end of the data structure, delete an item, and find an item in each data structure Which data structure would you prefer to use and why
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
