Get in touch with us
Send us an e-mail
Question
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.
Summary
The question belongs to Computer Science, particularly to C language. The question here is about Quicksort, a sorting algorithm developed by Tony Hoare. A report on the relative run time complexity of the choice of pivot used in Quickisort algorithm has been answered in the solution.
Total Word Count 1249
Download Full Solution
During the third semester of my micro-biology course I was challenged by this very difficult protein content calculation in DNA assignment where I seriously needed help from some expert. Then only I came across HwA and found out how knowledgeable their experts are. They worked on my stuff and helped me understand the formula used in the assignment.
I often used to get baffled by the Theory X and Theory Y of management strategies when my friend told me to seek help from HwA. It was a great advice, I must say, because it helped me to get good grades and clear my concepts.
Being a research scholar in Australia demands that you submit your research proposals and dissertations in a particular format and follow a typical form of expression chalked out by your dissertation advisors. The online dissertation writing help experts at TheReliableTutor based out of Australia understand this specific need and write the research proposals and subsequent dissertation to meet those exact specifications. There is no disconnect between your requirements and the finished dissertation submitted.
I had few hours to submit my Role of Telecommunications in IT assignment and I was panicking to finish it. But no matter how much effort or research I was not getting the standard that I was aiming for. I put my faith in TheReliableTutor.com and what can I say its been an amazing journey ever since. The quality of the paper was exactly what my professor was looking for and it has helped improve my grades a lot.
The first year of my taxation course was full of disappointments as I often used to get the answers wrong and also my conception regarding the subject was not that clear. Then luckily while browsing for help in the internet I landed on this page of HwA and availed their services. The experience was wonderful and since I started to perform better in class with the help of the Australia taxation experts here in HwA.
Comments
this is a very good website
I have 50 questions for the same test your page is showing only 28
hi can you please help or guide me to answer my assignments. thanks
hi can anyone help or guide me to my assignments. thanks
This solution is perfect ...thanks
Hello Allison,I love the 2nd image that you did! I also, had never heard of SumoPaint, is something that I will have to exolpre a bit! I understand completely the 52 (or so) youtube videos that you probably watched. Sometimes they have what you want, sometimes they don't! However, it is always satisfying when you are able to produce something that you have taught yourself. Great job!Debra 0 likes
Perfect bank of solution.
great !
thanks for the quick response. the solution looks good. :)
thnx for the answer. it was perfect. just the way i wanted it.
works fine.