answersLogoWhite

0


Best Answer

Although you can quicksort a linked list in place, the lack of constant-time random-access into the list makes this operation inefficient, particularly if you wish to make use of the median-of-three optimisation when selecting pivots. That is, locating the middle element in a partition of n elements in a list will take O(n/2) time, and that's an unacceptable overhead for a large n due to the sheer number of partitions. The only alternative is to use the first or last element when selecting a pivot as those are the only two elements you have constant time access to.

However, if memory is not an issue, you can easily construct a parallel array of bi-directional iterators into the list with a single traversal, taking O(n) time. Once you have an array of iterators you can efficiently sort it. You then have the option of using the array to access the list in sorted order or you can traverse the array to reconstruct the list, extracting each element in turn and pushing it to the end of the list. Thus the total overhead is O(n*2) time.

User Avatar

Wiki User

7y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write a quick sort program using linked list and recursive methods?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the quick sort program using linked list and recursive methods?

Linked lists are not ideally suited to the quicksort algorithm because linked lists do not provide constant-time random access. The most efficient means of implementing quicksort upon a list is to move all the elements to an array, sort the array using quicksort, then move the elements back into a list. This increases the complexity by O(n*2), which is costly, but is more than compensated for by the improved efficiency of sorting an array.


What are the methods of quick bread?

to make it with water and flour


Quick and dirty compiler?

Quick and dirty compilers produce an object program quickly but in this stage code program may be inefficient of its storage consumption & its speed.


What kind of program is Quick Fit?

Richard Bradley developed a 15 minute fitness program targeting the corporate world called Quick Fit. The program meets the need for fitness whilst reducing the time required to undertake the program.


What is a program similar to Quick Books Pro?

"There is another company that makes a program like Quick Books Pro, it's called Intuit. Quick Books Pro has way better ratings though and is probably more efficient."


What is a quick weight loss program and what are the side effects of the program?

Fasting is a quick weight loss program. You should restrict the number of days fasting because it can harm your health if followed too long.Talk to you Dr. before starting any fast.


What cartoon program starts with the letter q?

Quick Draw McGraw


What do icons on a computer represent?

It provides quick access to a specific program.


Where can I find more information on quick weight loss program?

There are a number of programs that promise quick weight loss. I'd be very suspective of any program that makes such claims. http://quickweightloss.net/program.php


How do you install quicktime?

Quick Time is easy to uninstall with its own uninstall program, but some users still find difficulty in uninstalling it. Especially when it's corrupted, Force Uninstall it with Perfect Uninstaller that is quite avilable for you. Method One, Uninstall Quick Time * Find Quick Time in the program list of Perfect Uninstaller, press "Uninstall". * Quick Time is running its own uninstall program. Method Two, Force Uninstall Quick Time * Navigate to the directory C:\Program Files\ Quick Time, right click the folder "Quick Time" and select "Force Uninstall" from the right-click menu, Perfect Uninstaller will launch instantly as follows, press "Next" to go. * Perfect Uninstaller has found the driver program, press "Next" to remove. * Navigate to the directory C:\Program Files\ Quick Time again, right click the folder "Quick Time" and select "Force Uninstall" from the right-click menu, Perfect Uninstaller will launch instantly as follows, press "Next" to go. * Perfect Uninstaller has found the files and registry information, press "Next" to remove. * Quick Time has been uninstalled successfully and disappeared from the program list.


How do you program a garage door opener for a 2007 Cadillac Escalade?

quick way to program garage opener with 2007 cadillac escalade.


What is program synopsis?

A program synopsis is a brief summary or overview of a program. It typically includes key information such as the purpose of the program, the target audience, program objectives, and any important features or highlights. It is often used to provide a quick understanding of what the program is about.