Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

To compare performance of different sorting techniques. Programming instruction:

ID: 665994 • Letter: T

Question

To compare performance of different sorting techniques. Programming instruction: Write a Java program to implement selection sort, insertion sort, merge sort, and quicksort (may be as four separate methods). For each of the sorting techniques, use four input set in the supplied sample data file to compare their running time. These sorting techniques should achieve sorted data set in increasing order. The sample data file has 4 different data sets. The first set has all random numbers, the second set has all numbers equal, third set has the numbers already sorted in increasing order, and the fourth set has all number sorted in reverse (decreasing order). All data sets have equal number of items. Each of the sorting techniques must be applied separately on each data set and the time (in nanoseconds) to achieve the sorted output in each case must be noted. Each time, before sorting the input set, start the timer and after your sorting is done, stop the timer.

DO NOT USE arrays.sort() OR ANY OTHER IN-BUILT SORTING TECHNIQUES PROVIDED BY Java APIs. Write your own code (or, you may modify codes supplied in class) to implement the sorting technique. Also, note: THE INSTRUCTOR MAY USE A DIFFERENT DATA FILE TO TEST YOUR PROGRAM. That is, your program should not be data file dependent. MUST HAVE A SCANNER ASKING FOR THE USER TO ENTER THE DATA FILE OF THERE CHOICE. Name of the file is SortDatafile.txt it contain four number set's your code should be able to run the four number set through your arrays.

Explanation / Answer

stdafx.h #include "stdafx.h" #include #include #include #include #include using namespace std; long arraySize = 1000; const long max_arraySize = 300001; const int bSize = 200000; string data[max_arraySize]; string tempArray[max_arraySize]; static const char alphanum[] = "0123456789" "!@#$%^&*" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz"; int stringSize = sizeof(alphanum) - 1; char generate_random_string() { return alphanum[rand() % stringSize]; } void load_random_string() { ofstream inputFile; inputFile.open("inputStringData.txt"); inputFile
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote