John Biesnecker 世界潮流顺之者

SWEIQotD: Given a set of strings, return the smallest subset that contains prefixes for every string

This problem seems challenging at first, but ends up being solvable with an almost trivial extension of a standard trie. Read more

ADS: Diving into tries

Tries are one of my favorite data structures, and it feels like I constantly run into problems that they can help solve. Read more

SWEIQotD: Describe the most common ways to traverse a tree

Having to traverse a tree is a super-common operation, and you need to know all of the common ways to do that. Read more

SWEIQotD: Write a bignum class with addition and subtraction operations

Even though Python (and many other languages) have built-in bignum support, writing one can be an interesting exercise. Read more

SWEIQotD: Transform a sorted array into a binary search tree

Write a function that takes a sorted array and returns a binary search tree of minimal height. Read more

SWEIQotD: Are two strings anagrams?

Write a function that decides if two strings are anagrams. Read more

Understanding reservoir sampling

Reservoir sampling is a technique that allows you to pull a random sample of a series that's too large to fit into memory, or forever whatever other reason (maybe it's coming across an intermittent network connection) you can't access all at once. Read more

Hachiko: an asyncio wrapper for Watchdog

Cross-platform filesystem event detection is a difficult, but solved, problem. When I needed a solution for Python I quickly found Watchdog, but out of the box it doesn't work with asyncio. Hachiko is a lightweight wrapper around Watchdog that makes it and asyncio play nicely together. Read more

Lightweight asyncio-based actors for Python

I was looking for an actor model implementation based on Python 3.4's asyncio. I didn't find one, so I built one. Read more

Visualizing a scikit-learn decision tree

A major advantage of tree-based machine learning methods is that their logic is observable -- you can examine the tree or trees generated by the fitting process and see what decisions it is making to get to an output. Read more