Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Coding exercise: problem 2 solution code is provided as a reference. #1) Implement a fully working code for insertion, deletion and search for doubly-linked list

Coding exercise: problem 2 solution code is provided as a reference.

#1)

Implement a fully working code for insertion, deletion and search for doubly-linked list using Java

Note that the insertion should check for duplicate keys, and when there is no such key after exhausting the input display "the key does not exist"

Input: list of pairs of an integer and an operation, e.g. 1.in 3.in 5.in 3.del 2.in 1.sch..(insertions are to be taken place at the back of the head unless specified)

Input with no operations to insert in a specific position in the list other than the head (note that deletes are down only with reference to the value of the node than the position index):

A sample input sequence "1.in 3.in 5.in 3.del 7.in 9.in 11.in 12.in 2.in 1.sch 15.in_7"

(notice that pairs are delimited by a single space in between and also the input is to be read in from a file in a batch)

Output: the list before operation and the list after operation displayed on the screen standard out (not into a file)

Note that the output of a "sch" is to be "found" or "not found"

If a duplicate is inserted display "duplicate key". (I know it's an O(n), smiles), and reject it. Any other way different then not it in a readme file

--------------------------------------------------------------------------------------------------------------------------

PROBLEM 2 IS ALREADY FINISHED AND FULLY WORKING

Implement insertion (or push) and deletion (or pop) for a stack and a circular queue with length of n keys as defined in class.

Input: list of pairs of an integer and an operation, e.g. 1.in 3.in 5.in 3.del 2.in .. or 10 1.push 2.push 5.push 3.pop 2.push *note that the 10 before 1.push is the length of the queue *Note that input is to be read from a file in a batch. In queue*

Output: the list before operation and the list after operation displayed on the screen standard outout (not into a file) Notice that for stack, 3.del is invalid so just ignore 3 or just perfom "del".

A command line user interface has to be provided as follow: "enter your input file name"

image text in transcribed

import java io.BufferedReader; o a else if(opli].equals("del")){ import java io FileReader al remove Integer (oplo])); (new import java io,IOException System out.println(oplo]+" is poped from stack"); import java.utilArrayList; import java util Scanner public class CodingExercise em out.println("InMnStack is Syst public static void main(String argsO) throws IOException{ for (int j al size j> oj--) new Scanner (Syst Scanner sc em in System.out.print (al.get(i)+" Syst enter your input file name String fname sc next Array List

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

More Books

Students also viewed these Databases questions