Write a nodups() method for the higharray class

Assignment Help JAVA Programming
Reference no: EM131604469

Programming Projects

To the HighArray class in the highArray.java program (Listing 2.3), add a method called getMax() that returns the value of the highest key in the array, or -1 if the array is empty. Add some code in main() to exercise this method. You can assume all the keys are positive numbers.

Modify the method in Programming Project 2.1 so that the item with the highest key is not only returned by the method, but also removed from the array. Call the method removeMax().

The removeMax() method in Programming Project 2.2 suggests a way to sort the contents of an array by key value. Implement a sorting scheme that does not require modifying the HighArray class, but only the code in main(). You'll need a second array, which will end up inversely sorted. (This scheme is a rather crude variant of the selection sort in Chapter 3, "Simple Sorting.")

Modify the orderedArray.java program (Listing 2.4) so that the insert() and delete() routines, as well as find(), use a binary search, as suggested in the text.

Add a merge() method to the OrdArray class in the orderedArray.java program (Listing 2.4) so that you can merge two ordered source arrays into an ordered destination array. Write code in main() that inserts some random numbers into the two source arrays, invokes merge(), and displays the contents of the resulting destination array. The source arrays may hold different numbers of data items. In your algorithm you will need to compare the keys of the source arrays, picking the smallest one to copy to the destination. You'll also need to handle the situation when one source array exhausts its contents before the other.

Write a noDups() method for the HighArray class of the highArray.java program (Listing 2.3). This method should remove all duplicates from the array. That is, if three items with the key 17 appear in the array, noDups() should remove two of them. Don't worry about maintaining the order of the items. One approach is to first compare every item with all the other items and overwrite any duplicates with a null (or a distinctive value that isn't used for real keys). Then remove all the nulls. Of course, the array size will be reduced.

Attachment:- Java.rar

Reference no: EM131604469

Questions Cloud

Create a summary of the students activities : you will need variables to store the number of times the student engaged in each activity. The summary might be created in app.java after the for loop
What price should you be willing to pay for this bond : Consider a non-callable bond with 5 years to maturity and an annual coupon of 4%. What price should you be willing to pay for this bond?
What factors contribute to the yearly incidence : What factors contribute to the yearly incidence and mortality rates of various cancers in Americans?
Define the diagnosing and treatment of personality disorders : Identify and describe the ethical issues associated with the diagnosing and treatment of personality disorders
Write a nodups() method for the higharray class : Write a noDups() method for the HighArray class of the highArray.java program (Listing 2.3). This method should remove all duplicates from the array.
Define the lagrange multipliers in multivariable calculus : In many applications, we want to maximize or minimize some quantity subject to a condition. Such constrained optimization problems are solved.
Summarize the concept of spaced repetition : Summarize the concept of spaced repetition and explain its relationship to learning
Community-based volunteer health organization : In 2014 The American Cancer Society began a partnership with Stand Up To Cancer to help fund additional research for lung cancer and developing new therapies.
Explain what type of stalker does this typify : What type of stalker does this typify, Should your friend contact the police

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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