Skip to content
HomeVideosBooksBlogs
AllTop postsTopics
Podcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    K

    Keith Schwarz

    keithschwarz.com · Personal blog · on HN since 2011

    Keith Schwarz, a Stanford computer science lecturer, writes about algorithms and data structures and keeps an archive of interesting code.

    Visit blogHN submissions
    ProgrammingMath
    What HN says

    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".

    Stats for nerds
    50HN people shared it
    28linked in comments
    685story points
    Sep 2025last shared
    2012people per year2025

    Top posts on HN

    1. 1
      Darts, Dice, and Coins: A beautiful article on a beautiful algorithm
      19 people · 251 points · first shared 2011 · 13 comments on HN
    2. 2
      The Archive of Interesting Code
      14 people · 185 points · first shared 2011 · 24 comments on HN
    3. 3
      CS143: Compilers (2011)
      1 person · 143 points · first shared 2015 · 62 comments on HN
    4. 4
      Smoothsort Demystified (2011)
      5 people · 103 points · first shared 2011 · 3 comments on HN
    5. 5
      Finding the most-significant bit in constant time, independent of word size
      1 person · 2 points · first shared 2018 · Discussion on HN
    6. 6
      This problem (reportedly) took Don Knuth, 24 hours to solve
      4 people · 1 points · first shared 2015 · 1 comments on HN
    7. 7
      Cs143
      1 person · first shared 2019
    8. 8
      Code
      1 person · first shared 2013
    9. 9
      Homepage
      1 person · first shared 2017
    10. 10
      Code
      1 person · first shared 2013

    What HN people wrote when they linked it

    • efreakJul 2020

      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

    • erganemicAug 2022

      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/

    • bhrgunathaSep 2019

      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

    • eruSep 2025

      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.

    • gamegoblinNov 2014

      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.

    • namelezzJan 2017

      > 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

    Related

    The Math Less Traveledmathlesstraveled.com23 people

    Factorization diagrams in Haskell

    The Math Less Traveled
    Personal · last shared 2025
    The Orange Ducktheorangeduck.com74 people

    Machine Learning, Kolmogorov Complexity, and Squishy Bunnies (2019)

    The Orange Duck
    Personal · last shared 2026
    Herb Suttergotw.ca84 people

    Ritchie, Stroustrup, and Gosling interview

    Herb Sutter
    Personal · last shared 2026
    Probably Danceprobablydance.com74 people

    Fibonacci Hashing: The Optimization That the World Forgot

    Probably Dance
    Personal · last shared 2026
    Computational Complexityblog.computationalcomplexity.org98 people

    When did computer science theory get so hard?

    Computational Complexity
    Personal · last shared 2026
    Gödel's Lost Letterrjlipton.wordpress.com185 people

    Mihai Pătraşcu 1982–2012

    Gödel's Lost Letter
    Personal · last shared 2021
    Alan Wolfeblog.demofox.org54 people

    Derivatives, Gradients, Jacobians and Hessians

    Alan Wolfe
    Personal · last shared 2026
    LessWronglesswrong.com2.4k people

    The Best Textbooks on Every Subject

    LessWrong
    Publication · last shared 2026