Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Quicksort implementation issue - Java
#17
happylight Wrote:Er no? With an array of all duplicates, their implementation would still run as fast as merge sort whereas yours would be as slow as selection sort.

Let's see.

Theirs does:
- n comparisons
- n/2 swaps
- (50<>50) split
- The total work done outside of the recursion is O(n), and they have logn number of recursion layers.

Mine does:
- n comparisons
- no swaps
- (1<>n-1) split
- The total work done outside of the recursion is O(n) -albeit with a lower coefficient-, and I have n-1 number of recursion layers.

Seems to be the case. I should somehow circumvent this.
Reply


Messages In This Thread
Quicksort implementation issue - Java - by Russt - 2012-04-29, 06:21 PM
Quicksort implementation issue - Java - by Corn - 2012-05-02, 03:36 PM
Quicksort implementation issue - Java - by nRxUs - 2012-05-04, 01:54 AM
Quicksort implementation issue - Java - by Spaz - 2012-05-04, 07:27 AM
Quicksort implementation issue - Java - by Corn - 2012-05-04, 07:38 AM
Quicksort implementation issue - Java - by Kalovale - 2012-05-04, 06:43 PM
Quicksort implementation issue - Java - by Russt - 2012-05-05, 03:55 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)