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.
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
|