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

  A digital forensic investigator for a healthcare organizatio

Imagine you are a digital forensic investigator for a healthcare organization. You learn from your internal information security department that an employee has been using password-cracking software to access confidential customer insurance informati..

  Paper on human-computer interaction

Write a paper which is called Human-computer interaction

  Find at least three definitions for object-oriented program

find at least three definitions for object-oriented programming. Compare the definitions and compile them into one definition in your own words.

  What is a predefined control event

What is a predefined control event? Discuss its usage in programming.

  Mobile phone photo analysis

Mobile Phone Photo Analysis

  How can laser be tipped before light no longer continues

If a laser is to be pointed into the end of the fibre, but is "tipped" to one side by θ degrees, how much can the laser be "tipped" before the light no longer continues down the fibre?

  What is the quadratic formula

What is the quadratic formula? What is it used for? Provide a useful example, not found in the text.Please note that the quadratic formula is different from a quadratic equation.Post a 100-200 word response

  Introduction to website development

In this course, you will be creating a 3-page Web site using HTML5 and CSS3. The content of the Web site is your choice. The elements that must be included are a home page (index.html) and two other pages.

  Program that allows a user to enter 10 item stock

Write a program that allows a user to enter 10 item stock numbers, prices, quantities in stock into three parallel arrays. Display all the data in report form - that is, aligned correctly in columns.

  Override the insert method in bst

You should override the insert method in BST. Your overriding method should first call the method it is overriding. When 50 insertions have been performed since the last rebalancing.

  Does the diagram above represent a function f: x ? y

Does the diagram above represent a function f: X → Y? Explain why or why not

  Calculates the velocity and momentum of an object

Write a program that does the following: Calculates the Velocity and Momentum of an object. The formula for the velocity is V=d/t and the formula for Momentum is m=mass*velocity. Your program should consist of two functions: Passing By Values (..

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