Trees/OOP
From charlesreid1
Tree data structures provide a great application of many object-oriented programming principles.
Abstract class interfaces allow you to impose a uniform interface for different tree types or tree implementations, and have it all be transparent to the user.
Template method pattern is a pattern that involves creating functional hooks (before/after hooks), so-called "template methods". These are useful for doing things like customizing a tree traversal.
Generic type/template interfaces are useful for storing arbitrary data in trees - templated tree node classes are useful because the data stored in the tree is not usually material to the schema of the tree itself.