(Java) Quicksort in Java, with Enforced Suckitude

It’s no fun implementing QuickSort unless you can force it out of its blister-fast, O(n log n) speed and humiliate it with its worst-case, O(n^2) runtime. So that’s what I set out to do.

My naive partition simply pivots around the low item, but my randomized partition defeats the sucky basiron ac kaufen. inputs by choosing a random pivot. (If you’re interested in checking out a QuickSort which naively partitions until it hits an attempt to get it to run in quadratic time, check out IntroSort — which simply fails over to Merge Sort when it exceeds its optimal recursion depth.)

  • Posted by on January 1st, 1970

This entry was posted in Java and tagged , , , , , , . Bookmark the permalink. Trackbacks are closed, but you can post a comment.

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Why ask?