Report on quicksort algorithm in c language

Assignment Help Basic Computer Science
Reference no: EM13829734

Problem:

Task

The quicksort algorithm was developed in 1960 by Tony Hoare while in the Soviet Union, as a visiting student at Moscow State University. At that time, Hoare worked in a project on machine translation for the National Physical Laboratory. He developed the algorithm in order to sort the words to be translated, to make them more easily matched to an already-sorted Russian-to-English dictionary that was stored on magnetic tape. Quicksort is a divide and conquer algorithm. Quicksort first divides a large list into two smaller sub-lists: the low elements and the high elements. Quicksort can then recursively sort the sub-lists.

The steps are:

1. Pick an element, called a pivot, from the list.

2. Reorder the list so that all elements with values less than the pivot come before the pivot, while  all elements with values greater than the pivot come after it (equal values can go either way). After this partitioning, the pivot is in its final position. This is called the partition operation.

3. Recursively sort the sub-list of lesser elements and the sub-list of greater elements.

The base case of the recursion are lists of size zero or one, which never need to be sorted.

Choice of pivot

In very early versions of quicksort, the leftmost element of the partition would often be chosen as the pivot element. Unfortunately, this causes worst-case behavior on already sorted arrays, which is a rather common use-case. The problem was easily solved by choosing either a random index for the pivot, choosing the middle index of the partition or (especially for longer partitions) choosing the median of the first, middle and last element of the partition for the pivot (as recommended by R. Sedgewick). Selecting a pivot element is also complicated by the existence of integer overflow. If the boundary indices of the subarray being sorted are sufficiently large, the naïve expression for the middle index, (left + right)/2, will cause overflow and provide an invalid pivot index. This can be overcome by using, for example, left + (right-left)/2 to index the middle element, at the cost of more complex arithmetic. Similar issues arise in some other methods of selecting the pivot element.

Task Requirement

You are required to conduct an empirical experiment to investigate the relative run time complexity of the choice of pivot on the quicksort algorithm.  You will implement three such pivot finding algorithm and evaluate their performances.  You will be required to document your experiment using the following standards.

1.  Prepare a journal ready article of between 5 and 6 pages detailing your empirical study.

2.  Be sure to design your experiment such that it exhibit validity and is robust.

Additional Information:

This question is it from Computer Science, particularly to C language. The question here is about Quicksort, a sorting algorithm developed by Tony Hoare. A report upon relative run time complexity of choice of pivot used in Quickisort algorithm has been answered in the solution.

Total Word Limit: 1249 Words

Reference no: EM13829734

Questions Cloud

Develop a website which can store country-wise data : Use the data in the XML documents provided to perform the tasks below:
Greatest good for a man to discuss virtue every day : greatest good for a man to discuss virtue every day
End-of-year balance in retained earnings : Jamaica Tours, Inc., started the year with a balance of retained earnings of $1,780 million. The company reported net income for the year of $284 million and paid dividends of $17 million to the preferred stockholders and $59 million to common stockh..
Assignment on purdue''s policy on academic integrity : What do you believe the consequences be if a student is caught cheating by using a crib sheet on an exam when crib sheets are explicitly not allowed in the exam
Report on quicksort algorithm in c language : The quicksort algorithm was developed in 1960 by Tony Hoare while in the Soviet Union, as a visiting student at Moscow State University.
Learned from the subprime mortgage meltdown : What lessons can be learned from the subprime mortgage meltdown? Could a similar crisis occur (perhaps in the student loan market) in the future? Were the big banks the only ones responsible?
Conclude all these forms of government are pestilential : conclude all these forms of government are pestilential
Explains about comparison between traits of self and others : The problem is belongs to Sociology and the problem is explains about comparison between traits of self and others. Various things to compare such as hairstyle, style of dress, food that is taken and the feelings.
Validating or verifying email addresses : Write a function that will check to see if your email address resembles a valid email address. Create three functions with names, functionality and style.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Design and code a project to calculate the amount due

Design and code a project to calculate the amount due for rentals. Movies may be in VHS(videotape) format or DVD format. Videotapes rent for $1.80 each and DVDs rent for $2.50.

  Write a class named candy

Write a constructor that takes arguments for the candy's name, it's calories per serving, whether it contains peanuts, and it's sourness.

  Describe graphical user interfaces-communications message

Describe some of the graphical user interfaces (GUIs) and communications messages that occur during operation of a microwave.

  Pseudocode or code for simple task

Then post pseudocode or code you would write for simple task (making peanut butter sandwich, for example) as well as three simple control structures that could be used to create this algorithm

  Locate vendors of biometric products

Using the Web, locate vendors of biometric products. Find one vendor with a product designed to examine each characteristic mentioned in your textbook. What is the CER associated with each product? Which would be more acceptable to users? Which..

  Write down the vbscript code that employs a do until loop

question 1. write the vbscript code that uses a do until loop to display all of the integer values stored in the array

  Create class includes instance variables automatic propertie

Create a class called Employee that includes three pieces of information as either instance variables or automatic properties - a firstname (type string), a last name (type string) and a monthly salary (decimal)

  Compare and contrast twisted pair cable

Compare and contrast twisted pair cable, coaxial cable, fiber-optics, and wireless for this application. You should create a table or flow chart which would facilitate choosing between these options depending on circumstances.

  Consider two upgrade paths for a machine

Assume that the cost is $600 for the CPU upgrade and $700 for the disk subsystem upgrade. Under the two scenarios of (1.1) and (1.2) above, which upgrade would you recommend and why?

  What term was a major issue during the process

What term was a major issue during the process of continuously dubbing media? Digitization cured this issue.

  Assume you are the it manager for an organization tasked wit

Assume you are the IT manager for an organization tasked with evaluating whether or not to deploy internal wireless access for employees. Discussing the advantages and disadvantages of deploying a WLAN in an organization. Compare the benefits and ris..

  Write a java application that inputs three integers

Write a Java application that inputs three integers from the user and displays the sum, average, product, smallest and largest of the numbers.

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