Design and implement a java program

Assignment Help Programming Languages
Reference no: EM13668870

Consider the two algorithm optimization proposals QuickSortOpt1 and QuickSortOpt2, described below. QuickSortOpt1 executes QuickSort until partitions size gets lower than a given cutoff value (usually 10) and then, executes InsertSort for sorting the small partitions. QuickSortOpt2 executes QuickSort until partitions size gets lower than a given cutoff value (usually 10) and then, executes InsertSort on the whole "almost sorted" array. 

Design and implement a Java program which defines an array of size SIZE, randomly populated with Integer or int values in the range 1 .. MAXRNG and sorts the array in increasing order of its values using QuickSortOpt1 and then by QuickSortOpt2. Consider two program execution cases defined by the value of the boolean constant SHOW. 
a) (SHOW value is true). The program should display the array values before sorting and then after invoking each sorting method. For this case, consider SIZE value 100 and MAXRNG value 9999. 
b) (SHOW value is false). Measure the execution time of the three sorting algorithms using System.nanoTime() method and display their average values for 10 runs (array values should not be shown). Fill-in the table below with the measured values considering SIZE value 100,000 and MAXRNG value 999,999. Discuss the results. 
Algorithm Measured mean values of the execution time 

QuickSortOpt1
QuickSortOpt2
2. Deliverables 
a) All .java source files. 
b) Screenshots showing program execution and the results of your testing. 

 

Consider a user interface menu using doubly linked lists as main data structures. 
The menu consists of a set of main menu items, each main menu item having associated a submenu consisting of a set of submenu items (see the example in the attached file). 

The set of main menu items should be implemented as a doubly linked list of mNodes, each mNode representing a main menu item. Each mNode defines the main menu item name, two links to its mNode neighbors (the previous and next mNode) and a link to its first submenu node. 
Each submenu should be implemented as a doubly linked list of smNodes. Each smNode contains its name and two links to its smNode neighbors (the up and down smNode). 
The data structures of a particular user interface menu are shown in the attached file. 
Your task is to design, write and test a java program Menu.java executing the following tasks: 
a) Read a menu from an input file Menu.txt and build the linked lists data structures. Each file line contains a main menu item followed by its submenu items, all items being separated by the semicolon character. 
Example of input file content: 
File;New;Open;Save;SaveAs;Close 
View;Color;Gray;Zoom;Ruler;Grid 
Process;Select;Move;Rotate;Scale;Delete;Group 
About;Release;Version;Contact;Description 
b) Traverse the linked lists data structures and display the menu, using the same format as the one in the input file. The main menu items and the submenu items will be traversed in forward direction. 
c) Add a new main menu item and its associated submenu to the existing menu. Read the new main menu item data from an input file MenuAdd.txt. The input file contains two lines. The first line specifies the main menu node after which the new main menu node will be inserted. The second line specifies the new main menu node and its submenu nodes. Display the menu after adding the new main menu item. The main menu items will be traversed in backwards direction while the submenu items will be traversed in forward direction. 
Example of adding a new menu item 

For example, the file content below specifies that the new main menu item called Layout (with submenu items Margins, Orientation and Size) will be inserted into the existing menu after the main menu item View. 
View 
Layout;Margins;Orientation;Size 
d) Ask the user to enter the name of a main menu item and remove it from the menu. Traverse the linked lists data structures (in the same direction as of question b)) and display the menu after the remove operation was performed. 

Reference no: EM13668870

Questions Cloud

Is it better to minimize the cost of the inventory : Is it better to minimize the cost of the inventory with a method like EOQ or to order only to meet demand? Why?
What is their marginal tax rate : Assuming they had a combined $18,000 in federal income taxes withheld, how much of a refund will the Johnsons receive? What is their marginal tax rate?
The eoq model : The EOQ model has a number of assumptions. List them and explain whether they are readily attainable. For example, will the adjustment for quantity discounts easily work?
Based on the learning curve : Based on the learning curve from (1), calculate the total time requires to produce the first 400 units, and the average time of the first 200 units.
Design and implement a java program : Design and implement a Java program which defines an array of size SIZE, randomly populated with Integer or int values in the range 1 .. MAXRNG and sorts the array in increasing order of its values using QuickSortOpt1 and then by QuickSortOpt2. Consi..
Which would you choose and why : The one hundred mile Leadville Marathon is being held on a very hot day and you are running the medical tent. A runner is brought in unconscious and with severe dehydration. You have Nursing Assistants taht know how to do IV''s, but you have to decid..
Determine what business organization entity : This first task is to determine what business organization entity she should choose.  Please explain the different business formats and which one you would suggest for her business which will be named "Portraits by Porter" (PBP).
Explain what is the molecular formula of the compound : If a 1.120 mole sample of a compound has a mass of 13.93g Explain what is the molecular formula of the compound
The calculated value of delta h differ from the actual value : If a student performs an endothermic reaction in a calorimeter, how does the calculated value of delta H differ from the actual value if the heat exchanged with the calorimeter is not taken into account

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a short report on a current game engine

Briefly introduce and discuss a game engine of students own choice. Students are encouraged to explore the concept and discussion of existing technologies which define a game engine.

  Write a program to enter series of numbers

Write a program that ask the user to enter a series of numbers ending with -1. After the -1 is input, program should print how many numbers are even and how many numbers are odd.

  Write program which instantiates objects of classes

Private data of Quadrilateral must be the x-y coordinate pairs for four end-points of the Quadrilateral. Write a program which instantiates objects of your classes and outputs each objects area (except Quadrilateral.

  Data members to store values of the two loans

A class that represents a person who belongs to a SACCO has two data members to store values of the two loans the person owes the SACCO. Add a parameterized constructor that initializes these loans using the two values passed as arguments.

  Write a loop that will show the price of silver and gold

Write a C++ program that displays a table showing the price of silver and gold. The table will have three columns. The first column will be labeled Ounces, the second labeled Silver

  Write program to ask user for low and high integer

Write a program that asks the user for the low and high integer in a range of integers. The program then asks the user for integers to be added up.

  Create a very abstract programming environment

Find these header files in the Visual Studio system and determine the smallest (i.e., most negative) and largest (i.e., most positive) values that can be represented as int, unsigned int, long, unsigned long, float and double.

  Create application which simulates functionality of gas pump

Create application which simulates functionality of gas pump. The user enters number of gallons to buy and clicks desired grade.

  Automate the task of invigilator allocation

you are required to carry out the following to automate the task of invigilator allocation which may not be limited to one's own department.

  Write script to declare and sets variable equal to balance

Write a script that declares and sets a variable that's equal to the total outstanding balance due. If that balance is greater than $10,000.00, the script should return a result set consisting of VendorName.

  Write application to which create-print random phone number

Write down the application which creates and prints random phone number of form xxx-xxx-xxxx. Write the dashes in output. Do not let first three digits contain 8 or 9.

  You need to find out the average score and how many scores

suppose that you have an array of baseball scores type integer called scores. the values in the array are ordered from

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