Category Archives: Uncategorized

Poker puzzle

A variant of this problem came up in discussion recently, that I think lends itself to attack via either mathematical “pencil and paper” or “write a program” analysis: What is the median poker hand? More precisely, among all possible five-card … Continue reading

Posted in Uncategorized | Leave a comment

Calling Java from MATLAB with pass-by-reference arrays

MATLAB has a pretty intimate connection with Java, supporting the creation and manipulation of native Java objects directly in MATLAB source code. For example: Contrast this with C++, where it is typically necessary to write an additional small amount of … Continue reading

Posted in Uncategorized | 4 Comments

How to tell time using GPS, and the recent Collins glitch

Introduction Last week on Sunday 9 June, hundreds of airplanes experienced a failure mode with some variants of the Collins Aerospace GPS-4000S sensor, grounding many business jets and even causing some delays among regional airlines. Following is the initial description … Continue reading

Posted in Uncategorized | 3 Comments

A potential exploit of a Mountain Dew promotion

Introduction This past Monday marked the start of a 10-week promotion where you can buy bottles of Mountain Dew, each with a label showing one of the 50 United States. Collect all 50 state labels, and win $100 (in the … Continue reading

Posted in Uncategorized | 9 Comments

Tracking heap memory use in Windows

Introduction I recently encountered a problem with a C++ program that was allocating more memory than it should. It wasn’t leaking memory– that is, the program was well-behaved in the sense of eventually releasing every byte of memory that it … Continue reading

Posted in Uncategorized | 1 Comment

Follow-up: I found two identical packs of Skittles, among 468 packs with a total of 27,740 Skittles

Introduction This is a follow-up to a post from earlier this year discussing the likelihood of encountering two identical packs of Skittles, that is, two packs having exactly the same number of candies of each flavor. Under some reasonable assumptions, … Continue reading

Posted in Uncategorized | 50 Comments

Printing a single-elimination tournament bracket

How should the teams be arranged in a “seeded” single-elimination tournament bracket? This question is motivated by the NCAA men’s basketball tournament, the first two rounds of which are now in the books. There are 64 teams in the tournament, … Continue reading

Posted in Uncategorized | Leave a comment