In computer science, an algorithm might be classified as either lazy or eager. A lazy algorithm delays carrying out computations until the last minute, while an eager algorithm attempts to perform computations as soon as possible. Both approaches save time in different ways, and are appropriate in different situations. For example, if a program tends…
Tag: algorithms
Metric space
We take for granted that we can measure distances. Most people take for granted that we can represent physical space mathematically and calculate distances between pairs of points. We generally think of ourselves as living in R3, or 3D Euclidean space. Since this is how we represent physical space, it’s generally the most useful (though…
A different view of the multiplication and division algorithms
The “traditional” methods for multiplying or dividing numbers have generally been taught by rote memorization or with minimal explanation. By reframing these processes, I hope to make it more clear what is happening. Column method of multiplication This is similar to the column methods of addition and subtraction, although multiplication is slightly more complicated. Here’s…
How compression works and why JPEG artifacts look like that
Do I look like I know what a JPEG is? In a computer, all information is represented as bits, strings of zeros and ones. However, bits can more or less be interpreted as generic numerical data written in base 2 instead of as decimals. In other words, in a computer, all information is represented as…
