Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

I can't get seem to get this quicksort algorithm to work...  RSS feed

 
Tom Liu
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone help me? I've tried and tried and tried, but I can't seem to get this quicksort algorithm to work. I can't seem to find whats wrong with it. The sorting is perfect in most cases except one of the number is out of place. Sometimes, an infinite loop occurs. Here's the code:


Please help inspecting it. Thank you very much.
[ May 19, 2005: Message edited by: Tom Liu ]
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the minimal sequence of ints that fails to get sorted correctly?
 
Mihai Alexe
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try entering a sequence of values that cause an infinite loop to occur and then step with any IDE debugger to see what fails. This should reveal the problem.
[ May 23, 2005: Message edited by: Mihai Alexe ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!