hi can anyone please send me the non recursive version of the quicksort program in C++...i badly need it a simple one
ReplyI downloaded the source code, but it is not working properly.
Here is the sample output i got:
How many keys would you like to enter : 5
Now enter the elements separated by
Hi: I apologise for being late in replying. Well, it has really been a long time since I have written this article. However, after receiving your complaint-notification I tested the same key-set on my PC and it worked perfectly - yielding correct output. Perhaps, problem is somwhere else than in the algorithm/code. Try removing preceding 0 from the second key you enter and then let me know whether you receive the same errorneous result. Regards, zipcn046.
ReplyGo here for a non-recursive, highly optimized quicksort implementation in C. It also includes a step-by-step diagram showing the best way to carry out one partition in the fewest possible moves: http://alienryderflex.com/quicksort
ReplyDear Nanu2010, Yes, it is possible to develop an algorithm for non-recursive QuickSort. Kindly refer to the following webpage at my website to get an answer of your query, http://khatri-krishna.tripod.com/cgans.htm Regards, Krishna Kumar KhatriReply
can you give me a non recursive version of quicksort that uses a stack. the version should store at the stack indicies[i,j] of subarrays that have not been sorted yet. what is the number of [i,j] pairs, non-sorted sunarrays that can belong to stack simultaneously.
Dear Nanu2010, Yes, it is possible to develop an algorithm for non-recursive QuickSort. Kindly refer to the following webpage at my website to get an answer of your query, http://khatri-krishna.tripod.com/cgans.htm Regards, Krishna Kumar KhatriReply
the demo project doesn't work properly! if the user enters 5 tokens, the sorted list eats up the largest token, and always makes 0 the shortest token, no matter whether 0 was entered as a token or not! it needs fixing! does the source mirror this error, or does it still work?
ReplyOriginally posted by: RaspberryJam
Dear Krishna,
The comments you seem to unfortunately invite seem more interesting than your articles. (in fact I did just that)
Anyways, it brought back sweet memories of my CSE classes 12 years back.
keep up the good work.
Some interesting thoughts
1. Anthony Hoare (born 1934 in Sri Lanka), who invented QUICKSORT now works for MICROSOFT! So doodlsquats to the guys who said MS knows nothing about writing libraries!!
2. http://research.microsoft.com/~thoare/
;-)
Originally posted by: WellWisher
Knock Knock !!!
Is moderator awake ?
NO
ReplyOriginally posted by: telemark
what the hell is wrong with posting yet-another-quick-sort-implementation? as i saw, it's the only one available on codeguru, and since i first search here if code fragments needed, it helped solving a problem in about 10 minutes while coding it on my own would have taken at least an hour...
did i get smth wrong about the intention of this site?
Originally posted by: Dheeraj
Not so helping?????