Revisiting Knuth and McIlroy's word count programs
Here’s the problem:
Read a file of text,
determine the n
most frequently used words,
and print out a sorted list of those words along with their frequencies.
Here’s the problem:
Read a file of text,
determine the n
most frequently used words,
and print out a sorted list of those words along with their frequencies.
Another puzzle courtesy the Daily Coding Problem email list.
Daily Coding Problem: Problem #1578 [Hard]
This problem was asked by Facebook.
Given an array of numbers of length N
,
find both the minimum and maximum using less than 2 * (N - 2)
comparisons.
Github repo for my solution.
This is from the Daily Coding Problem email list. The owners of that list haven’t sent out a problem that caught my imagination in quite a while.
Daily Coding Problem: Problem #1553 [Hard]
This problem was asked by Airbnb.
You come across a dictionary of sorted words in a language you’ve never seen before. Write a program that returns the correct order of letters in this language.
For example,
given ['xww', 'wxyz', 'wxyw', 'ywx', 'ywz']
,
you should return ['x', 'z', 'w', 'y']
.
Github repo for my solution. Feel free to look it over, try it and email me (bediger8@gmail.com) if you notice anything.
I ran across an engineering aphorism or principle called “Gall’s Law”:
A complex system that works is invariably found to have evolved from a simple system that worked. The inverse proposition also appears to be true: A complex system designed from scratch never works and cannot be made to work. You have to start over, beginning with a working simple system.
GPP is the General Purpose Preprocessor, a macro preprocessor for various forms of structured and unstructured text.
A quine is a computer program which takes no input and produces a copy of its own source code as its only output. There’s usually a few conditions on what the program can do, like not reading it’s source code during execution.
I wrote what I believe to be the first non-vacuous quine ever in the GPP language.
There’s at least two things that one might conflate under the “Daily Coding Problem” rubric:
They’re related, as the book is a byproduct of the success of the email list. Both are deficient, but for different reasons
Once upon a time, I wrote a reasonably-strict-C89 C language program that “relocates” a function in memory and then runs it. That relocated function can relocate itself again, and run that copy, and so on and so forth.
I wrote a Cryptoquip solver.
My big contribution here is using the “shape” of the words to narrow the choice of clear text letters.
I wrote a program that generates images in the style of Piet Mondrian:
Generate more images in this style, including tuning parameters.