Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1093
  • Last Modified:

Writing a Quick sort in C++

For my AP class i need to write a quick sort with iterative?? which i don't know what it means.... i can write bubble and insertion sorts but this sort confuses me i don't know where to start.. any ideas would be very helpful.. thanx
Birdman
0
corey2024
Asked:
corey2024
1 Solution
 
SalteCommented:
Quicksort is by its very nature a recursive sort. It is not iterative. If you want a non-recursive you therefore have to make your own stack

Alf
0
 
InternCommented:
example code:
http://ciips.ee.uwa.edu.au/~morris/Year2/PLDS210/qsort1a.html


Quick Sort: The quick sort algorithm contains two phases: the partition phase, which splits an array of data into two separates partitions, and the sort phase, which sorts each partition. The quick sort algorithm is extremely popular, and is also known as the "divide and conquer" method.

A quick sort algorithm divides an array of items into partitions and calls a quick sort procedure to recursively sort the partitions. Each call to the quick sort procedure divides the results into two further groups until each item in the array is ordered correctly.
0
 
Rapture273Commented:
If you are allowed, you may prefer to use a linked-list class to make your list in the first place. This automatically sorts the data.
If you are not allowed to do that, then try the algorithm offered by Intern above.
0
 
udilCommented:
This question has been abandoned. I will make a recommendation to the moderators on its resolution in a week or two. I appreciate any comments that would help me to make a recommendation.

In the absence of responses, I may recommend DELETE unless it is clear to me that it has value as a PAQ. Silence = you don't care.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Udil
EE Cleanup Volunteer
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now