Keith Schwarz, a Stanford computer science lecturer, writes about algorithms and data structures and keeps an archive of interesting code.
HN commenters call his Archive of Interesting Code an amazing collection of algorithms and link his article on sampling discrete distributions, "Darts, Dice, and Coins".
There's been a few flash runtimes in javascript and other languages. Most of them have been long abandoned.
https://github.com/tobeytailor/gordon
https://www.gnu.org/software/gnash/
In development:
https://github.com/lightspark/lightspark
https://github.com/ruffle-rs/ruffle
And then the most recent one, CheerpX, which as I understand it runs the Adobe flash runtime itself via wasm: https://leaningtech.com/pages/cheerpxflash.html
Which brings me to Java. Java left the browser even before flash did. Not all of these are javascript jvms, but all of them are intended to run Java applications in the browser (some are transpilers, others require code changes):
https://leaningtech.com/pages/cheerpj.html
https://github.com/java2script/java2script (this links to some less-complete projects)
https://github.com/Jivings/jsJVM
https://github.com/nurv/BicaVM
https://github.com/st-js/st-js/
https://github.com/plasma-umass/doppio
https://github.com/jtulach/bck2brwsr
https://www.keithschwarz.com/+script/
https://github.com/robterrell/orto
https://github.com/jdstroy/JavaPoly
https://gitlab.com/neoexpert/jvm/-/blob/master/jsjvm/README.md
Coming up with algorithms on the spot isn't a viable strategy for technical interviews any more, even if you're a super-genius. Here's a question that the page author claims took Donald Knuth 24 hours to solve [1], which is classified on Leetcode as a Medium(!) difficulty question [2]. Leetcode Medium questions are typically the cut-off point for most FAANG-tier interview questions--and while this is a hard medium, I know someone who got a variation of it at a Meta interview, and was expected to solve it in 30 minutes. So unless you're 48 times faster at inferring algorithms than one of the best algorists in the world, memorizing tricks is the game you have to play if you want a FAANG-adjacent job!
Of course, then the natural reaction is "if your hiring process would pass on Donald Knuth, your hiring process is broken," which is absolutely true, already known, and (apparently) deemed acceptable.
[1] https://keithschwarz.com/interesting/code/?dir=find-duplicate
[2] https://leetcode.com/problems/find-the-duplicate-number/
University Of Washington
CSEP501: Compiler Construction
http://courses.cs.washington.edu/courses/csep501/
Keith Schwartz Stanford Compiler course CS143
http://www.keithschwarz.com/cs143/
Stanford's Engineering Compiler course on Lagunita
https://lagunita.stanford.edu/courses/Engineering/Compilers/Fall2014/about
Matt Might's courses are self educational blueprints
http://matt.might.net/teaching/compilers/
Book
Introduction to Compilers and Language Design
https://www3.nd.edu/~dthain/compilerbook/
I'm not a fan of uncurated link dumps, however:
Awesome compilers link aggregation on Github
https://github.com/aalhour/awesome-compilers
It depends a bit on exactly what you mean.
But eg if you want to write a new hash table (with a new hash function), you'd want to do pretty similar-ish analysis to figure out whether it's a good idea.
I used some neat math in my time to justify much simpler algorithms than what we were using before. (But not hash table related.)
https://www.keithschwarz.com/darts-dice-coins/ is also a joy to read. (As mentioned in the discussion on https://news.ycombinator.com/item?id=8006336 )
Have a look at eg https://www.eecs.harvard.edu/~michaelm/postscripts/handbook2001.pdf for some more in this flavour.
A minor grumble, but the filenames are not intuitive at all to me... It makes finding what I'm looking for a bit difficult.
alea.py
clea.py
dlea.py
flea.py
ilea.py
lea.py
olea.py
plea.py
tlea.py
Also if anyone is interested in floating point weights, look at the alias method. Good tutorial here: http://www.keithschwarz.com/darts-dice-coins/
EDIT: User rawnlq beat me to mentioning the alias method. I second the recommendation.
> Remember Google infamously rejecting Max Howell, the original Homebrew author
If Donald Knuth interviewed with Google, he would fail too because he would need 24 hours to solve a hard level leetcode question[1]. Unfortunately, Google loves throwing those kind of questions at interviewees and expect them to come up with solutions within 1 hour interview, lol.
[1] - http://keithschwarz.com/interesting/code/?dir=find-duplicate