Create sortedlist object reference

Assignment Help Data Structure & Algorithms
Reference no: EM131308975

Code a doubly links, sorted list (in ascending order). Each item of the list will just store int. You 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), assessors, 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 to code 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 (ie., 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 return false.

*toString: this method takes no parameters and returns a String representation of the list.

*constructor (at least one), and assessors 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 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 (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: EM131308975

Questions Cloud

Prepare a summary of transactions for the company : Prepare a summary of transactions for the company for these transactions. Use money columns headed Cash, Accounts Receivable, Equipment, Accounts Payable, Capital Stock, and Retained Earnings
What is the effective annual rate of this credit offer : Round House Furniture offers credit to its customers at a rate of 1.15 percent per month. What is the effective annual rate of this credit offer? City Motors will sell a $15,000 car for $345 a month for 52 months. What is the interest rate?
Solicitation number and contract award : Once in the website, you will enter your search criteria for the state and type field for a solicitation (either pre-solicitation or Combined Synopsis/Solicitation). Include the Solicitation Number and Contract Award date in your proposal title pa..
Explain the methods the company uses : Name a current advertising slogan you believe is particularly effective for developing a unique selling proposition. Explain the methods the company uses, the target market, and strategies that you think are effective in advertising this product. ..
Create sortedlist object reference : Create SortedList object reference. Your insert and delete methods should work properly in all possible scenarios: inserting in an empty list
Explain the more complex aggregate demand curve : Tell one story that explains the negative slope of a simple demand curve and another story that explains the more complex aggregate demand curve (AD).
Explain the three popular data models and its nature : Explain the three popular data models and its nature of relationship (1-1;1-M;M-M) of the elements in these models
Interest rate on loan with the compensating balance : Suppose your firm is seeking a five year, amortizing $390,000 loan with annual payments and your bank is offering you the choice between a $404,500 loan with a $14,500 compensating balance and a $390,000 loan without a compensating balance. The inter..
Complexity theorists advice : How can managers let go of control, yet still ensure that organizational activities are coordinated with each other aligned with organizational goals? What could managers do to mitigate the potentially negative consequences of following complexity..

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Create a binary search tree program

Creating a Binary Search Tree program - Finding the largest and smallest values in the tree Add two class methods

  Explain message switching network & packet switching

Sometimes when a mobile user crosses the boundary from one cell to another the current call is abruptly terminated even though all transmitters and receivers are functioning perfectly Why?

  Algorithm to compute binomial coefficients

Analyze the time taken by this algorithm under the unreasonable assumption that the addition C(n-1, k-1) + C(n - 1, k) can be carried out in constant time once both C(n-1, k-1) and C(n - 1, k) have been obtained recursively.

  Explain how randy can send a plaintext p to james secretly

IONA Corporation has the following class C Internet License: 193.1.1.0. IONA Corp. would like to allow for exactly 32 sub-networks using subnetting.  (193.45.1.0 -> 11110001.00000001.00000001.00000000). How should Iona Corp. divide up the bits in..

  Create a program that has an array of length hundred

Create a program that has an array of length 100 which will automatically be filled with randomly generated numbers between 1-100 each time the program is run. Have the program ask the user to enter a number between 1 and 100.

  What are the characteristics of a binary tree

What are the characteristics of a binary tree? Define the left child of node n in a binary tree. What are the three properties of each node n in a binary search tree

  What is the largest x such that the protocol performs x-bit

What is the largest x such that the protocol performs x-bit correction and what algorithm would you use to perform this correction? Give me the pseudo-code (or a sensible explanation)

  Question about database administration

Should the data administrator really be on the same level as the DBA, generally somewhat low in corporate hierarchy or should this person have an elevated level of importance?

  Documentation and proper design procedures

Determine the main reason that make many developers skip over the documentation and proper design process? As a manager, discuss how do you ensure that the proper database design process are followed by database development teams?

  Generates all the possible n-node binary tree

Implement a function that generates all the possible N-node binary tree configurations. The value N is a parameter to the function and the function should return a list of binary tree. Any container ADT (list, queue, vector, etc...) will be used t..

  Write an algorithm that converts a decimal number

Write an algorithm that converts a decimal number between 0 and 15 into its 4 bit unsigned binary representation.

  Problem 1given n courses along with their course strength

problem 1given n courses along with their course strength and m examination halls along with their capacity assign the

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