computer science

Count number of heaps coding problem

Count number of heaps coding problem

Bruce Ediger

Another programming interview question from the Daily Coding Problem email list. I received it as #1608.

Daily Coding Problem: Problem #1608 [Medium]

This problem was asked by Microsoft.

Write a program to determine how many distinct ways there are to create a max heap from a list of N given integers.

For example, if N = 3, and our integers are [1, 2, 3], there are two ways, shown below.

  3      3
 / \    / \
1   2  2   1

Repo for my code.

Wordle, January 30, 2024

Bruce Ediger

wordle grid 955

I solved 955 without any computerized help, but I think my second-to-last guess can generate an interesting regular expression.

GPP Quine

GPP Quine

Bruce Ediger

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.

Algorithmic Squava Players

Bruce Ediger

squava game in progress

I have four algorithms in my second attempt at writing algorithmic “players” for the game of Squava:

  1. Alpha-beta minimaxing
  2. Alpha-beta minimaxing with a better static evaluation function
  3. Monte Carlo Tree Search
  4. Monte Carlo Tree Search with UCT child selection

At this point, all but plain MCTS (#3 above) regularly beat me. How do my programmatic squava players do against each other?

Algorithmic players Elo ratings