Create a sortedlist object reference

Assignment Help Basic Computer Science
Reference no: EM13495290

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.

 

Reference no: EM13495290

Questions Cloud

How to calculate the solubility of caso4 : The Ksp of CaSO4 is 4.93× 10-5. Calculate the solubility (in g/L) of CaSO4(s) in 0.500 M Na2SO4(aq) at 25 °C
Uml conceptual view and process view : UML Conceptual View and Process View
Use technology and information resources to research issues : Discuss the considerations for implementing an operating and database system. Recommend the optimum system, considering the types of revenue and expense transactions for this company.
Explain the zeeman effect is observed as a splitting : The Zeeman effect is observed as a splitting in the spectral lines of hydrogen in the presence of a magnetic field. What is the greatest number of lines that a single spectral line can be split into by a magnetic field? a)2 b)3 c)4 d)5 e)6
Create a sortedlist object reference : Create a SortedList object reference
Identify and analyze each of the preceding transactions : Prepare a list of accounts and their balances for Moonlight Bay at January 31, 2012. Reflect the recurring transactions for the month of January but not the necessary month-end adjustments.
Explain assuming no heat loss by the system : Assuming no heat loss by the system, what will be the final temperature when 84 g of water at 10.0oC are mixed with 67 g of water at 50.0oC
Keeping track of calculations manually : Explain the benefits of using Excel as opposed to keeping track of calculations manually
Extracting company''s data using web data extractor : Extracting Company's Data Using Web Data Extractor

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Describe the various components of the logic of the study

Describe the various components of the logic of the study of science. How does an understanding of this logic contribute to an understanding of the goals of science?

  . what options does atrium have for acquiring a new system

Atrium Bio-Medical Supply is a medium sized regional supplier of medical and laboratory equipment.Since starting 12 years ago,Victoria Dawn has built Atrium into a competitive supply company across several metro areas,but her growth potential is l..

  Given a set of n points in the cartesian plane

Design an algorithm for the following problem: Given a set of n points in the Cartesian plane, determine whether all of them lie on the same circumference

  You can add require to any of the input types. true or false

You can add require to any of the input types. True or false

  Explaining social network widgets and resaurant locators

The popularity of Apple's iPhone and Application store has made _____ improtant to advertisers, who see social network widgets, resaurant locators.

  Strategic advantages voip brings to businesses

Write down some of the strategic advantages the VoIP brings to businesses that adopt it? Prior, voice and data networks were separate and typically maintained by separate groups.

  How to make system more user-friendly

What improvements or additions to the system do you believe would advantage you or make system more user-friendly? Why?

  When deleting elements from a hash table with linear probing

When deleting elements from a hash table with linear probing, a special marker needs to be inserted in place of each deleted elements. Give an algorithm to perform deletion without the use of a special marker.

  Compare clock cycle times and execution times

Instead of a single cycle orgization we use multicycle organization where each instruction takes multiple cucles but only one instruction finishes before another is fetched. in this organization.

  Write and test the code to implement the state diagram

Design a state diagram to recognize one form of the comments of the C-based programming languages, those that begin with /* and end with */. and Write and test the code to implement the state diagram.

  Explain what is done in each of the risc states

Explain what is done in each of the RISC states for the 5 types of MIPS instructions represented with R, I, and J instruction formats.

  Develop an understanding of domain knowledge about a range

In completing this assignment, you are expected to use available resources such as the practical activities in the study modules, the Communication skills handbook, the Course Study Desk – especially the Discussion List

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd