Write a method that uses the bst to output

Assignment Help Data Structure & Algorithms
Reference no: EM13337042

Part 1: Array of Objects

Program Specification

1. Using appropriate classes and methods to implement a Java application that reads the ASCII file entries (of your chosen topic) sequentially into an array of objects. You can reuse code from the workshop exercise on arrays but do not treat as perfect. The objects should contain several separate attributes and types eg string, double, Boolean, date etc. The test file should be between 10 and 20 entries in the file. As the program reads each entry (string) it should split it into distinct data items (fields) in order to form an object and store it in the array.

2. Write a method that uses the array to output to the console the list of entries in reverse order. Each entry is displayed on a new line.

3. Write a method that uses the array to calculate and return the average of one of the numerical values.

Quality (eg layout, comments, exception handling and simplicity).

 

Part 2: Binary Search Tree

Program Specification

1. As before using appropriate classes and methods implement a Java application that reads the ASCII file entries into a binary search tree (BST), where each node (object) contains the objects chosen. Use a suitable field (attribute) as the key. You can reuse code from the workshop exercise on Trees but do not treat as perfect. Again, as the program reads each entry (string) it should split it into distinct data items (fields) in order to form an object and store it to the BST.

2. Write a method that uses the BST to output to the screen the list of entries in alphabetical order. Each entry is displayed on a new line.

3. Write a method to count the number of items in the BST (Note that you should do this by traversing the BST and not in any other way). The method returns an integer.

4. Write a method to search the BST to find and return the largest of some value.  ** Peter to clarify key or non-key value

5. Write a method that searches the BST for a given input name and returns the corresponding numerical value. If the item is not in the list of entries then a suitable message is displayed.

Quality (e.g. layout, comments, exception handling and simplicity).

Reference no: EM13337042

Questions Cloud

Determine the frequency of the dampened oscillation : A 9.60 kg object oscillates at the end of a vertical spring that has a spring constant of 2.00 104 N/m. Calculate the frequency of the dampened oscillation
Calculate the lateral shift produced of a rectangular glass : A ray of light is incident oa an angle of 60 degree on once face of a rectangular glass slab of thickness 0.1m and refractive index 1.5. Calculate the lateral shift produced
Compute cholatis branch profits tax : Compute Cholatis branch profits tax, and determine its branch interest withholding tax obligations. Assume that Cholati does not reside in a treaty country.
How much would be an ink dot to be raised by a glass plate : The velocity of light in glass is 2*10^8 m/s and in air is 3*10^8 m/s. How much would be an ink dot to be raised, when covered by a glass plate of 6cm thick
Write a method that uses the bst to output : Write a method to count the number of items in the BST (Note that you should do this by traversing the BST and not in any other way). The method returns an integer.
Determine its branch interest withholding tax obligations : At the start of Year 2, Hans sold the building for $350,000. Hans' adjusted basis in the building at that time was $290,000. What are the U.S. tax consequences of Hans' U.S. activities?
How much are going to be paid for 7 days straight : paid $20 an hour. working for 7 days straight , 14 hours every day 7am to 9pm. How much are you going to be paid
Determine the final volume : 830 J of heat is added to an ideal gas which is maintained at a constant temperature and a pressure of 1.0 atm. what is the final volume
Explain some of advantages that fiber optic cable has over : Explain some of the many advantages that Fiber Optic Cable has over other media (e.g. conductive wires) in the transport of information.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Writing algorithm which ?nds xbest

Provide an O(n) algorithm which ?nds xbest such that distbest:= ∑i=1 to n|xbest - xi| is as small as possible.

  Write program to do operaretions of stack-push-pop-peek

Write down the program which does the basic stack operations: Make the stack. Push element into the stack. Pop element from the stack.

  Identify data structures to organize typical file cabinet

Identify at least two data structures that are used to organize a typical file cabinet. Why do you feel it is necessary to emulate these types of data structures in a computer program?

  Difference between sequential, random and binary file access

Discuss the difference between sequential file access, random file access, and binary file access? For each of the three types, provide an example of an application where the use of one type is better than the other 2-types.

  Converting arithmetic expression in reverse polish notation

Convert the following numerical arithmetic expression into reverse Polish notation and show the stack operations for evaluating the numerical result.

  Question about isdn

Today ISDN cost $40 every month for BRI service which includes 1 D Channel and 2 B Channels. Every channel is capable of transmitting 64kbps of voice, data, video or fax for a total of 128 kbps.

  Er diagram of cardinality and modality

Read the following information about World Relief for Disaster Victims (WRDV), a fictional nonprofit organization that provides aid to victims of natural disasters.

  Create greedy algorithm-multiple breakpoint distance problem

Breakpoints between pi and p. Create greedy algorithm for Multiple Breakpoint Distance problem and estimate its approximation ratio.

  Shell scripting based questions

Determine will the following only print the text "I FOUND A MATCH" to standard output when the grep is successful? if grep "mrichard" /etc/passwd; then echo "I FOUND A MATCH"; fi

  Creating an access database

PLUS is a corporation that makes all types of visual aids for judicial proceedings. Customers are usually private law firms, although the District Attorney's office has occasionally contracted for its services.

  Perform an insertion sort on the file pointed

Using only the local data already supplied in FileSort, perform an insertion sort on the file pointed to by fd. Use lseeks for this; do not try to create any sort of array or list. An array-based version of insertion is supplied for your reference.

  Sketch dynamic programming tables for knapsack problem

Sketch Dynamic Programming Tables (one for calculating optimal value and one for keeping track of items used in getting optimal value) for 0/1 Knapsack Problem given below and illustrate your final result.

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