Of all the data structures that I have studied so far, my favorite is probably the Tree. I’d like to introduce you to some of the basics. Caveat: If you’re unsteady with Linked Lists, I strongly recommend you practice that structure first. When you’re comfortable with pointers, traversal and reversal, you’re ready for Trees.
By name alone, the most intimidating basic algorithmic technique is dynamic programming. The definition sounds simple enough. The code should transform a complex “problem into a sequence of simpler problems.” One of the most straightforward ways to simplify these complex problems is to store the values of smaller examples into an array or hash for future use. This becomes more natural with time, so let’s take a look at a few examples.
1. Rocky at the Philly Art Museum
Rocky Balboa wants to climb the steps outside the Philadelphia Museum of Art. There are 72 stone steps from the…
One of my favorite programs for macOS is Ubersicht, which renders custom widgets to the desktop. The widgets available for download can be out-of-this world; some developers have published widgets to track the International Space Station or check the weather on Mars.
What’s a linked list? I don’t mean a news aggregator like Reddit, a guide to local golf course, or a catalogue of chains. I certainly don’t mean a register of video game characters.
Let’s pretend that you’re the manager of a professional baseball team. The bus pulls up the hotel, where you have many reservations for the players.
The ordinary managerial practice is to book a block of rooms on the same hall and to assign players to rooms based on their position. …
Ruby includes a type of Proc called a lambda. What’s the fuss? Why have a separate kind of Proc?
The lambda expressions are the expressions of the lambda calculus, a topic in theoretical computer science. They were developed by a mathematician named Alonzo Church.
At the most basic level, a lambda expression permits us to model any computable function.
As a trivial example, a familiar function f(x) = x + 3 can be translated to an anonymous lambda expression like so:
Church proved that lambda expressions can model all computations. Turing, his contemporary, proved the same with his…
Ready for a DRY read?
The class definitions of an object-oriented approach remind me of the construction of some topics in math, like number systems. We start with a strict description of an atom, and we can build molecules. In this example, we mimic the formal construction of the Naturals, proceed to ordered pairs and equivalence classes, and thereby describe Integers and Rationals.
DRY, but WHY?
Well, computers are very good at math; I am not. There are uncountably many numbers, and I have seen about 0% of them. Nonetheless, the computer seems to have some difficulties with arithmetic. For…