We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There are some major problems with TestAdversary (based on A Killer Adversary for Quicksort by M. D. McIlroy).
The data field is modified by Swap() but ignored by Less(), so swapping has no effect.
data
Swap()
Less()
Less() compares elements using >=, which is messed up.
>=
The test never checks anything, so it will always pass. It should count the number of comparisons and fail if there are too many.
The size 100 is too small to distinguish between O(n^2) with a small constant factor and O(n*log(n)).
(nitpicking) map[int]int can be replaced with []int, which is much more efficient.
map[int]int
[]int
The text was updated successfully, but these errors were encountered:
Change https://golang.org/cl/58330 mentions this issue: sort: fix TestAdversary
sort: fix TestAdversary
Sorry, something went wrong.
3723d08
No branches or pull requests
There are some major problems with TestAdversary (based on A Killer Adversary for Quicksort by M. D. McIlroy).
The
data
field is modified bySwap()
but ignored byLess()
, so swapping has no effect.Less()
compares elements using>=
, which is messed up.The test never checks anything, so it will always pass. It should count the number of comparisons and fail if there are too many.
The size 100 is too small to distinguish between O(n^2) with a small constant factor and O(n*log(n)).
(nitpicking)
map[int]int
can be replaced with[]int
, which is much more efficient.The text was updated successfully, but these errors were encountered: