Reference no: EM13713925
Question -Objective: The objective of this homework is familiarize you with the performance characteristics of Quick sort under normal and worst case conditions. The assignment will require some programming and interpretation of the results.
Assignment: Using the pseudo code provided in the Cormen text for Quick sort, implement a working program that uses Quick sort to sort the elements in an array. In order to make meaningful comparisons, your array should be fairly large. (Try n=10,000 and see if you observe measurable changes in performance.
You might also try a larger array if the time measurements do not vary significantly.) Do not use the library function, as it may include features that will prevent you from observing the differences between expected and worst case performance.
I propose that your program be implemented in c, or c++, so that you can use debugging tools, such as gdb and ddd, if necessary.
Case 1- Generate a main program which initializes your data array to be sorted - be careful with your array index numbers. You can use a random number generator to generate entries for the array.
Then, call your Quicksort routine and sort the array while you measure the elapsed time. In the same program, using the sorted array as an input, call your Quicksort routine and again measure the elapsed time.
Case 2- Modify your code to use a randomized selection of the pivot value as shown in the Randomized Quicksort pseudocode and rerun the experiment. Again, measure the execution times of sorting unsorted and already sorted arrays.
Answer this question and show each and every step with example.
Proposal to ensure the application of the concepts
: Prepare the Outline of the Final Project based on your approved Project Proposal submitted in Week 4. The Outline must be structured on the Proposal to ensure the application of the concepts and techniques learnt in this module.
|
Design a java program that simulates a slot machine
: Instead of displaying images, the program will randomly select a word from the following list: Cherries, Oranges, Plums, Bars, and Bells. The program will select and display a word from this list three times.
|
A current passed through a sn(no3)2 solution
: A current of 5.63 A is passed through a Sn(NO3)2 solution. How long (in hours) would this current have to be applied to plate out 8.20 g of tin
|
What role do personality
: What role do personality, national culture, and organizational culture play in influencing an individual's ethics
|
Generate a main program which initializes
: Generate a main program which initializes your data array to be sorted - be careful with your array index numbers. You can use a random number generator to generate entries for the array.
|
Determine the volume of the container after the h2
: At a fixed temperature, equal moles of H2 (g) and O2 (g) are mixed in a constant pressure container (the volume of the container changes in order to keep the pressure at a constant value). The H2 (g) and O2 (g) are allowed to react, producing H2O ..
|
Show the brute-force attack against single des
: Your task is to show that breaking the scheme is approximately as difficult as a brute-force attack against single DES.
|
Define at what temperature of krypton occupy a volume
: At what temperature (in oC) does 11.25 g of krypton occupy a volume of 5.44 L at a pressure of 1.07 atm? Report your answer to 3 significant figures and do not include units in your answer.
|
How is ethics and ethical behavior apparent
: How is ethics and ethical behavior apparent in corporate culture. What is the relationship between law, values, and ethical behavior
|