Skip to main content

Blog Archive for cayhorstmann during May 2011

A red-black tree is a binary search tree with the following additional properties: Every node is colored red or black. The root is black A red node cannot have a red child (the “no double reds” rule) All paths from the root to a null have the same number of black nodes. I call this the “equal exit cost” rule. Here is one: Of course, the nodes aren't actually colored. Each node simply has...
I needed some filler material for my lectures on concurrency. I googled around for Java concurrency pitfalls and came up with a nice mixture of golden oldies and new ones (at least new to me). I cleaned them up and translated them into Scala because that's what we use in the course. Here they are, for your puzzling pleasure. Rules of the game: For each of these, the question is “What could go...
In my programming languages course, we have come to the one subject that students fear more than continuations—concurrency. My inbox fills with desperate queries about programs that yield mysterious results, simply hang, or in the worst case, cause the computer to overheat and reset. Here in Vietnam, that's surprisingly easy with a multi-core laptop whose fan was calibrated for an air-...