Design and implement a program to test the qsopt1 and qsopt2

Assignment Help Data Structure & Algorithms
Reference no: EM131100971

Java- Data Structures and Analysis

Prefered Netbeans

Design:

Employs Modularity (including proper use of parameters, use of local variables etc.) most of the time

Employs correct & appropriate use of programming structures (loops, conditionals, classes etc.) most of the time

Efficient algorithms used most of the time

Excellent use of object-oriented design

Functionality:

Program fulfills all functionality

All requirements were fulfilled

Extra effort was apparent

Test Plan:

Comprehensive test plan.

Documentation:

Excellent comments

Comprehensive lessons learned

Excellent possible improvements included

Excellent approach discussion and references

Quick Sort Optimizations through Hybridization

1. Specification

Part 1

Consider the attached QuickSort algorithm for sorting arrays and two algorithm optimization proposals QSopt1 and QSopt2, described below.

QSopt1 executes QuickSort for the partitions of size larger than a given cutoff value (usually 10) and executes Insertion Sort for sorting the partitions of size less than or equal to the cutoff value.

QSopt2 executes QuickSort until all partitions' size gets lower than a given cutoff value (usually 10) and then, executes the improved Bubble Sort algorithm upon the whole "almost sorted" array.

This project requires writing two Java programs detailed below in Part 1 (testing the functionality of the proposed algorithms) and in Part 2 (measuring and comparing their execution time). The algorithms for QuickSort, InsertionSort and BubbleSort are attached.

Part 1 (Testing algorithms functionality)

Design and implement a program to test the QSopt1 and QSopt2 algorithms. Define an array of size 100, populated with randomly generated Integer or int values in the range 1 .. 999 and sort the array in increasing order by using the algorithms QuickSort, QSopt1 and QSopt2. Display the array content before sorting and then after invoking each sorting algorithm.

Part 2 (Measuring the execution time)

Design, implement and test a program which uses System.nanoTime() method to (1) measure the execution time of the three sorting algorithms and (2) display the average execution time values for 105 runs. Do this for each of the array sizes specified in the table below. Consider the arrays as being randomly populated with Integer or int values in the range 1 .. MAX as specified for each SIZE in the table below. After executing the program, fill-in the table cells with the measured values and include the table in the solution description document.
Note that due to the behavior of the JVM and JIT compiler, the execution time of the algorithms is much slower the first times they are run and therefore make sure to discard the measured values for the initial 5 runs.

Table 1 - Average Execution Time Average execution time for 100 runs SIZE = 100 MAX = 999 SIZE = 1000 MAX = 9,999 SIZE = 10,000 MAX = 99,999 SIZE = 100,000 MAX = 999,999 QuickSort QSopt1 QSopt2

The programs should compile without errors.

Notes 1. The array contents should not be displayed for Part 2. 2. For Part 2, the three algorithms should be executed and their execution time should be displayed for the required array sizes within the same program execution and without any user input.

2. Submission Requirements

Submit the following before the due date listed in the Calendar:

1. Part1.zip including all .java files for Part 1 and Part2.zip including all .java files for Part 2. The source code should use Java code conventions and appropriate code layout (white space management and indents) and comments.

2. The solution description document <YourSecondName>_P3 (.pdf or .doc / .docx) containing: (2.1) assumptions, main design decisions, error handling, (2.2) test cases and two relevant screenshots, (2.3) the table of average execution time filled in with the measure values. (2.4) discussion of the results, (2.5) lessons learned and (2.6) possible improvements. The size of the document file (including the screenshots) should be of three pages, single spaced, font size 10.

Attachment:- Quick Sort Optimizations.zip

Reference no: EM131100971

Questions Cloud

Find the density function : a Find the density function of U1 = 2Y - 1. b Find the density function of U2 = 1 - 2Y .
Design a circuit to implement a seven-segment display : Design a circuit to implement a seven-segment display by OR-ing together the outputs of a 4-to-16 decoder. Let the inputs to the circuit be a 4-bit BCD value
Question regarding the stock expected price : A stock is expected to pay a dividend of $2 the end of the year (that is, D1=$2), and it should continue to grow at a constant rate of 4% a year. If its required return is 13%, what is the stock's expected price 3 year from today?
Use a sample of observations to make inferences : In chapter 9 we learned that it is possible to use a sample of observations to make inferences about an entire population, or as Hubbard puts it "How observing some things tells us about all things."
Design and implement a program to test the qsopt1 and qsopt2 : Design and implement a program to test the QSopt1 and QSopt2 algorithms. Define an array of size 100, populated with randomly generated Integer or int values in the range 1 .. 999.
Establishment of an australian-based company : The owner of a U.S. company that produces sound systems for home entertainment theaters is considering the establishment of an Australian-based company to produce and sell the systems there.
Often used to measure high-value information : Surveys are often used to measure high-value information. When you think of a survey, think of a set of variables. It's really that easy. For some problems, a survey question might be considered a dependent variable.
Times-interest-earned ratio : Trucker has $10 billion in assets, and its tax rate is 35%. Its basic earning power (BEP) ratio is 13%, and its return on assets is 6%. What is its times-interest-earned ratio?
What is its debt-to-capital ratio : What is its debt-to-capital ratio? Round your answer to two decimal places.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Open addressing with double hashing where second hash funcn

Given the input {3810, 8832, 8653, 2863, 3580, 8440, 1941, 4290, 8805, 7400}

  Algorithm to decide flavor of ice cream from three option

A group of ten people require to decide which one flavor of ice cream they will all order, out of three options. The algorithm can question and re-question participants.

  Prepare the algorithm to solve the puzzle

Alternating disks you have a row of 2n disks of two colors, n dark and n light.

  Design an algorithm to sort the elements using merge sort

What are preorder, Inorder, postorder traversals of a binary tree? Design recursion algorithms to implement them and explain with the help of an example.

  Difference between formulas and functions

Assume your mother in law heard that you prepared the budget for the high school reunion picnic and has asked if you could help her to make a monthly household budget.

  True or false about networking

2- A print queue must be set up for every printer on the network served by a print server. True False

  Write a program to simulate the behavior of an array

Write a program to simulate the behavior of an m * n array of two-input NAND gates. This circuit, contained on a chip, has j input pins and k output pins.

  Design a divide-and-conquer algorithm

Design a divide-and-conquer algorithm for the Motif Finding problem and estimate its running time. Have you improved the running time of the exhaustive search algorithm?

  Write a program to find average marks

Write a program to find average marks obtained by 10 students in a test along with algorithm and write a menu driven program using function to perform following operations on 1 d array?

  Question 1a explain the meaning of each of the following

question 1a explain the meaning of each of the following pointer declarations-i float a -0.137float pa ampaii double

  Explain in words a linear-time algorithm

The max subsequence product problem for an array a = a1,a2,...,an of integers is the problem of determining the largest product E(summation)k=1(bottom) j(top) ak formed by a subsequence of a.

  Database design

As with the previous exams(SQL,E-R diagram and Normalization, you may complete this assignment at any time up to its due date of December 8, 2013.

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