Challenging algorithms and data structures every programmer should try
I often find myself thinking: &quot;But how would I do any of these without reaching for mutation? So that I can later parallelize them?&quot; And then I come up empty. I still need to work through &quot;Purely Functional Data Structures&quot; by Okasaki. Hopefully then I will have an idea, of how to come up with a functional version to mostly single-core algorithms or at least locking-requiring algorithms.<p>I skipped ahead once and looked at functional red-black trees and the solution was to involve one more color! How ingenious is that?! I have no idea, how people got to these solutions.<p>In many places algorithms are described implicitly with mutation assumed. However, this can be very hard to parallelize later and might hit you in the future. In the times of many cores, this seems no longer appropriate to me. I wish we spent more time on learning how to get it done without mutation.<p>Another great post that was linked at some point on HN was this: <a href="https:&#x2F;&#x2F;nullprogram.com&#x2F;blog&#x2F;2020&#x2F;04&#x2F;30&#x2F;" rel="nofollow">https:&#x2F;&#x2F;nullprogram.com&#x2F;blog&#x2F;2020&#x2F;04&#x2F;30&#x2F;</a> -- A comparatively simple change in approach and yet it allows for massive parallelization without locks! This is the kind of stuff we should learn more about and then make more use of our many available cores, moving on from the single core world of algorithms.