Search:

Type: Posts; User: Nominal Animal

Search: Search took 0.01 seconds.

  1. Replies
    31
    Views
    8,427

    Ah, so you have. I only now realized the output...

    Ah, so you have. I only now realized the output thames showed was from your program. Okay, the swap count makes sense then, because your code uses random pivot selection. This thread has meandered so...
  2. Replies
    31
    Views
    8,427

    That's not why I asked. The reason I asked was...

    That's not why I asked.

    The reason I asked was because there are many variants of quicksort that do not cause any swaps to happen if the data is linear and ascending: ith data element being A*i+B,...
  3. Replies
    31
    Views
    8,427

    Is that the version of quicksort that moves...

    Is that the version of quicksort that moves (swaps) the pivot to the start/end first?
  4. Replies
    31
    Views
    8,427

    The CPU architectures have undergone some serious...

    The CPU architectures have undergone some serious changes. We now have branch prediction, efficient caching algorithms, even speculative execution, on typical processors. I suspect the relative cost...
  5. Replies
    31
    Views
    8,427

    Obviously. My code is a two-state state...

    Obviously.

    My code is a two-state state machine, where the first inner while loop locates the initial pair to swap. If none, it is done. Otherwise it continues into the actual swapping loop. The...
  6. Replies
    31
    Views
    8,427

    Really? My measurements disagree. Using Athlon...

    Really? My measurements disagree.

    Using Athlon II X4 640 (with a stable time stamp counter), median cycle counts for test sorts for uniform random input were


    # N ints, no padding, 100000...
  7. Replies
    31
    Views
    8,427

    Programming errors? Verifying the functions...

    Programming errors?

    Verifying the functions work is a simple form of unit testing. When I fiddle with sort functions, I write a test harness: a main() that generates test cases, sorts them,...
  8. Replies
    31
    Views
    8,427

    Good points (and by Adak, as well). I think I'll...

    Good points (and by Adak, as well). I think I'll switch to insertion sort, too.

    Like I said earlier, the data I sort tends to be large enough for radix sorting, so I've never paid much attention...
  9. Replies
    31
    Views
    8,427

    Oh no, that's not what I meant. I meant that in...

    Oh no, that's not what I meant. I meant that in post #2, you did not notice that thames' code will get stuck (never complete) if the pivot occurs more than once in the array.


    No selection sort?...
  10. Replies
    31
    Views
    8,427

    Yes, that is the correct location, when you use a...

    Yes, that is the correct location, when you use a random pivot selection.

    I don't think Adak noticed the issue with repeated pivots: your code sometimes gets stuck, if there are repeated numbers...
  11. Replies
    31
    Views
    8,427

    I'd like to point out a couple of things. First:...

    I'd like to point out a couple of things. First:


    The above is wasteful. On every invocation, you'll reinitialize the random number generator, based on the current time in seconds. Because the...
Results 1 to 11 of 11