HTML5 Canvas
Written by: Simon Sarris
Featured Refcardz: Top Refcardz:
  1. Apache Hadoop
  2. Web Driver
  3. MVVM
  4. REST
  5. ADO.NET
  1. HTML5
  2. Ajax
  3. jQuery Selectors
  4. CSS Part 1
  5. Git

Link Details

The more you vote, the better it gets. Login and vote now.
Link 74962 thumbnail
User 111696 avatar

By bloid
via hobershort.wordpress.com
Published: Apr 11 2008 / 07:55

Following on from last week’s implementation of quicksort in Python, we have a Java implementation to do the same thing. However, this version requires a bit more work, since Java is a lower level language than Python.
  • 6
  • 3
  • 2705
  • 0

Comments

Add your comment
User 242931 avatar

arcturus replied ago:

0 votes Vote down Vote up Reply

The quicksort code give in this article doesn't actually work correctly:


int[] arr = {2, 1};
quicksort(arr);
System.out.printf(Arrays.toString(arr)); // [2, 1]

User 282525 avatar

HoberShort replied ago:

0 votes Vote down Vote up Reply

This is the author of the post. As I mention in the comments on the post itself, the code above that "doesn't work", doesn't take the returned, sorted, array. Replace the second line with this and you might have better luck:

arr = quicksort(arr); ,
,

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (6)



Voters Against This Link (3)