gerben-s / quicksort-blog-post Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://blog.reverberate.org/2020/05/29/hoares-rebuttal-bubble-sorts-comeback.html
License: Apache License 2.0
Home Page: https://blog.reverberate.org/2020/05/29/hoares-rebuttal-bubble-sorts-comeback.html
License: Apache License 2.0
At the end of your blog post you've even tried implementing CPU-pipeline-efficient MergeSort. What about enhancing Quadsort (which is MergeSort, but with a tiny sorting network built-in) by your DistributeBackward
and DistributeForward
approach?
I pulled this into my code to see how it compared to a sort implementation I was using and found that the tests were hanging. After a little investigation, it wasn't hanging but was just performing very badly for the cases where all elements are equal. Looks like it partiions into subarrays of size 1 and n-1 and continues that all the way down or until it blows up due to too much recursion.
I haven't looked at any fixes, but wanted to know whether that was a known issue with the experimental code or whether that behavior had been overlooked.
Although the test is easy to reproduce, here is the code for completeness:
#include <hybrid_qsort.h>
#include <vector>
int main()
{
// std::vector<int> v(131071,1);
std::vector<int> v(1024,1);
exp_gerbens::QuickSort(v.data(), v.size());
}
Hi,
Since you've tried to make this algorithm general, in BubbleSort2, the line
if (y < x) std::swap(x, y);
should be
if (comp(y, x)) std::swap(x, y);
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.