Topics /

Math & Algorithms

The most popular blog posts about math & algorithms on Hacker News. 2,851 posts.

Any year
2314

NP-complete isn't always hard

A common assumption I see on the ‘net is that NP-complete problems are impossible to solve. I recently read that dependency management in Python is hard because package resolution is NP-complete. This is true in principle, but the reality is more complicated. When we say “NP-complete is hard” we’re talking about…

2317

Entropy in the Universe

If you click on this picture, you’ll see a zoomable image of the Milky Way with 84 million stars: But stars contribute only a tiny fraction of the total entropy in the observable Universe. If…

2318

Solving “Two Sum” in C with a tiny hash table

I came across a question: How does one efficiently solve Two Sum in C? There’s a naive quadratic time solution, but also an amortized linear time solution using a hash table. Without a built-in or standard library hash table, the latter sounds onerous. However, a mask-step-index table , a hash table construction…

2320

PID Controller: A Simple Control Loop Mechanism

A mid-depth cap with classic style for any occasion, this Nike Club Cap comes in smooth cotton twill that's been softly washed for casual, daily comfort. Soft and unstructured, the precurved bill makes for easy styling, and the adjustable back-strap lets you find the right fit. Nike Hat Size 6 1/2 6 5/8 6 3/4 6 7/8 7…

2323

How to Be Wrong (2016)

“To be wrong, or not to be wrong?” That is the wrong question. You are going to spend a lot of your time being wrong, especially if you become a scientist or mathematician. The question…

2326

Linear Algebra of Types (2019)

It gives my brain a pleasant thrum to learn new mathematics which mimics the algebra I learned in middle school. Basically this means that the new system has operations with properties that match those of regular numbers as much as possible. Two pretty important operations are addition and multiplication with the…

2331

A fast alternative to the modulo reduction (2016)

Suppose you want to pick an integer at random in a set of N elements. Your computer has functions to generate random 32-bit integers, how do you transform such numbers into indexes no larger than N? Suppose you have a hash table with a capacity N. Again, you need to transform your hash values (typically 32-bit ……

2336

When the bubble bursts

We are clearly not in a steady-state situation. Is this a bubble or a revolution? The answer surely includes a bit of revolution—the fields of vision and speech recognition have been turned over by great empirical successes created by deep neural architectures and more generally machine learning has found plentiful…

2337

Understanding the FFT Algorithm

The Fast Fourier Transform (FFT) is one of the most important algorithms in signal processing and data analysis. I've used it for years, but having no formal computer science background, It occurred to me this week that I've never thought to ask how the FFT computes the discrete Fourier transform so quickly. I dusted…