Skip to content

Commit

Permalink
Updated naming to reflect Hoare partitioning scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
zachary-kent committed Aug 31, 2023
1 parent c8c0a95 commit e809c9d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Benchmarks an implementation of quicksort with a median of three pivot
# scheme. We then generate several arrays with pseudorandom elements, sort them,
# and check that they are indeed in nondecreasing order by printing out "true"
# if the array is sorted correctly. This is based on my C implementation of
# quicksort from ECE 4750, which is in turn based off the classic CS 2110
# quicksort loop invariants. I attempted to optimize the median of three
# procedure to use the fewest number of swaps possible, which I believe I
# referenced from Wikipedia in my original C implementation.
# Benchmarks an implementation of quicksort with Hoare partitioning and median
# of three pivot selection. We then generate several arrays with pseudorandom
# elements, sort them, and check that they are indeed in nondecreasing order by
# printing out "true" if the array is sorted correctly. This is based on my C
# implementation of quicksort from ECE 4750, which is in turn based off the
# classic CS 2110 quicksort loop invariants. I attempted to optimize the median
# of three procedure to use the fewest number of swaps possible, which I believe
# I referenced from Wikipedia in my original C implementation.

# Swaps the data at two indices in an array
@swap(arr: ptr<int>, i: int, j: int) {
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion docs/tools/bench.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ The current benchmarks are:
* `pythagorean_triple`: Prints all Pythagorean triples with the given c, if such triples exist. An intentionally very naive implementation.
* `quadratic`: The [quadratic formula][qf], including a hand-rolled implementation of square root.
* `quicksort`: [Quicksort using the Lomuto partition scheme][qsort].
* `quicksort-median-of-three`: Quicksort using median of three pivot selection.
* `quicksort-hoare`: Quicksort using [Hoare partioning][qsort-hoare] and median of three pivot selection.
* `recfact`: Compute *n!* using recursive function calls.
* `rectangles-area-difference`: Output the difference between the areas of rectangles (as a positive value) given their respective side lengths.
* `relative-primes`: Print all numbers relatively prime to *n* using [Euclidean algorithm][euclidean_into].
Expand Down Expand Up @@ -99,5 +99,6 @@ Credit for several of these benchmarks goes to Alexa VanHattum and Gregory Yaune
[euler]: https://en.wikipedia.org/wiki/E_(mathematical_constant)
[euclidean]: https://en.wikipedia.org/wiki/Norm_(mathematics)
[qsort]: https://en.wikipedia.org/wiki/Quicksort#Lomuto_partition_scheme
[qsort-hoare]: https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme
[modinv]: https://en.wikipedia.org/wiki/Modular_multiplicative_inverse
[totient]: https://en.wikipedia.org/wiki/Euler's_totient_function

0 comments on commit e809c9d

Please sign in to comment.