top | item 22189192

Sorting Algorithms in C

98 points| ismdeep | 6 years ago |github.com

9 comments

order
[+] inciampati|6 years ago|reply
What's amazing to me is that sorting is still an open problem with active research producing new algorithms. It gets really tricky when you want to use parallel architectures to speed it up. Case in point: ips4o, https://github.com/SaschaWitt/ips4o
[+] thestoicattack|6 years ago|reply
So I was all set to bash include/data-swap.c for allocating on the heap every time you need to swap memory. Turns out that gcc can optimize out that temporary, and it ends up the same as std::swap.

But if we use operator new/delete instead of std::malloc the optimization doesn't take place: https://godbolt.org/z/vtxqD2

[+] ericwood|6 years ago|reply
Tangentially related: what resources would y'all recommend for learning modern-ish C?

I'm planning out a microcontroller project and reading through avr-libc I'm realizing my C skills have completely atrophied since college a decade ago. There seems to be a lot of outdated information out there, and honestly it's tough for me to judge the quality of what I'm reading. Any advice is greatly appreciated!

[+] gshdg|6 years ago|reply
Gee, this brings me back to second semester computer science class.