Static (Lexical) Scoping vs Dynamic Scoping (Pseudocode)

With static (lexical) scoping, the structure of the program source code determines what variables you are referring to. With dynamic scoping, the runtime state of the program stack determines what variable you are referring to. This is likely a very unfamiliar concept, since basically every programming language in wide use today (except perhaps emacs lisp) … Read more

Quicksort: Choosing the pivot

Choosing a random pivot minimizes the chance that you will encounter worst-case O(n2) performance (always choosing first or last would cause worst-case performance for nearly-sorted or nearly-reverse-sorted data). Choosing the middle element would also be acceptable in the majority of cases. Also, if you are implementing this yourself, there are versions of the algorithm that … Read more

What are the mathematical/computational principles behind this game?

Finite Projective Geometries The axioms of projective (plane) geometry are slightly different than the Euclidean geometry: Every two points have exactly one line that passes through them (this is the same). Every two lines meet in exactly one point (this is a bit different from Euclid). Now, add “finite” into the soup and you have … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)