A blog of Python-related topics and code.

Finding anagrams with a trie

A trie is an ordered tree data structure often used to store word lists, for example, for auto-complete applications. Each node in the tree is associated with a letter; the association of nodes with each other (parents, children, grandchildren, etc.) orders the letters into words. For example, the simple dictionary consisting only of the words "bat", "ball", "coo", "cow" and "cowl" could be represented by the trie in the figure below, in which the black circles indicate nodes which represent word terminators.

The Goldbach Comet

Goldbach's conjecture is probably one of the most famous unsolved problems in mathematics. It states that

Wa-Tor World

Wa-Tor is a population dynamics simulation described by Alexander Dewdney in Scientific American (1984): "Computer Recreations: Sharks and fish wage an ecological war on the toroidal planet Wa-Tor".

Disasters in Great Britain and Ireland over time

Wikipedia has an interesting (if somewhat morbid) list of disasters in Great Britain and Ireland. This blog post will show how to scrape it and plot a chart of the deaths due to these disasters over time.

How many MPs have degrees in STEM subjects?

Not many: