Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Code a doubly linked, sorted list (in ascending order). Each item of the list will just store an int.
You will need to code three classes: Node, SortedList, and GroupProject.
The Node class has three instance variables, all private:

  • an int, representing the value stored inside the Node
  • a Node (next)
  • another Node (previous)

The methods to code are: constructor (at least one), accessors, mutators.
The SortedList class is a doubly linked list, sorted in ascending order.
It has two instance variables, both private:

  • an int, representing the number of items in the list.
  • a Node, representing the head node in the list.

The methods are:

  • insert: this method takes one parameter, an int; it has a void return value.

• delete: this method takes one parameter, an int; it returns a boolean value. If we were successful in deleting the item (i.e., the value of the parameter was found in the list), then we return true; if we were not successful, then we want to output a message that the value was not found, and therefore, not deleted, and returnedfalse.

  • toString: this method takes no parameters and returns a String representation of the list.
  • Constructor (at least one), and accessors and mutators as appropriate.

All methods should keep the list sorted in ascending order.
The GroupProject class contains the main method; it should do the following:

  • create a SortedList object reference
  • insert successively the values 25, 17, 12, 21, 78, and 47 in the sorted list
  • output the contents of the sorted list using the toString method
  • delete from the sorted list the value 30, using the delete method (obviously, 30 will not be found)
  • output the contents of the sorted list using the toString method
  • delete from the sorted list the value 21, using the delete method
  • output the contents of the sorted list using the toString method

Your insert and delete methods should work properly in all possible scenarios: inserting in an empty list, inserting at the beginning of a list, inserting in the middle of a list, inserting at the end of a list, deleting from an empty list (cannot delete), deleting an item not in the list (cannot delete), deleting the first item in a list, deleting in the middle of a list, deleting the last item in a list.

 

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91032410

Have any Question?


Related Questions in Computer Engineering

Please tell me how to use the open system interconnection

Please tell me how to use the Open System Interconnection (OSI) model to troubleshoot network performance issues

In linux what synchronization methods they use within the

In Linux what synchronization methods they use within the kernel, please dig into your findings for Linux.

Imposing a tariff leads to the existence of two deadweight

Imposing a tariff leads to the existence of two deadweight triangles, which are the Consumption distortion and Production distortion losses. It is easy to understand why consumption distortion constitutes a loss for soci ...

Taskstudents are required to do the following tasks for

Task Students are required to do the following tasks for write report by answering all the questions at the end of case study: Task a: Answering all the questions at the end of case study. Task b: Student is required to ...

Question suppose we perform a sequence of n operations on a

Question : Suppose we perform a sequence of n operations on a data structure in which teh ith operation costs i 2 of i is an exact power of 2 and 1 otherwise. Use aggregrate analasys and accounting method to determine th ...

A confidence interval for a population mean is to be

A confidence interval for a population mean is to be estimated. The population standard deviation is guessed to be anywhere from 14 to 24. The half-width B desired could be anywhere from 2 to 7. Tabulate the minimum samp ...

Systems analysis projectpersonal trainer inc owns and

Systems analysis project Personal Trainer, Inc. owns and operates fitness centers in a dozen Midwestern cities. The centers have done well, and the company is planning an international expansion by opening a new "superce ...

A is the event that your friend is sick today and b is the

A is the event that your friend is sick today and B is the event that you pass this test. These events are independent and Not mutually exclusive. Calculate the probability that your friend is sick today OR you pass this ...

Question 1 with the explosion of users on social media

Question: 1. With the explosion of users on social media sites, businesses need to establish their presence on social media sites. Just search for "Vans" or "Starbucks" on Facebook for examples of company sites. To manag ...

String loop method write a java program to meet the

((String + Loop + method) Write a Java program to meet the following requirements: 1. Prompt the user to enter three strings by using nextline(). Space can be part of the string. 2. Write a method with an input variable ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As