16/03/2010
QuickSort, due to Hoare, is one of the best comparison-based sorting algorithms around. There are a number of variations, but the vanilla QuickSort does a great job… most of the times.

Indeed, there are occasions where QuickSort leaves its expected
run-time to reach
run-time, its worst case. But what does it take to push QuickSort into its worst behaviour?
Read the rest of this entry »
4 Comments |
algorithms, hacks, Mathematics, programming, rants, theoretical computer science, wtf | Tagged: bubble sort, C, comparison sort, computational complexity, evil, Hoare, malicious data, QuickSort, sort, sorts, Worst Case, Worst Case Behavior |
Permalink
Posted by Steven Pigeon
07/03/2010
Ulrich Meyer, Peter Sanders, Jop Sibeyn (eds.) — Algorithms for Memory Hierarchies — Springer, (Lectures Notes on Computer Science LNCS # 2625), 2003, 428 pp. ISBN 978-3540-00883-5

(Buy at Amazon.com)
This book is a collection of chapters on various topics pertaining to memory hierarchies and their algorithms, but written by several different authors, without any special uniformity in tone or topics; but that’s OK because it allows the reader to have a broad view of algorithms for memory hierarchies.
Read the rest of this entry »
Leave a Comment » |
algorithms, data structures, Mathematics, Operating System, programming, Suggested Reading, theoretical computer science |
Permalink
Posted by Steven Pigeon
07/03/2010
Peter Brass — Advanced Data Structures — Cambridge University Press, 2008, 492 pp. ISBN 978-0521-88037-4

(Buy at Amazon.com)
The first part of the book concentrates on search trees and variants, whether balanced trees, interval trees, or heaps. Chapters are dedicated to connected components and like algorithms, one to algorithms for strings, and one for hash tables. Follows appendices on computation, cache oblivious algorithms, etc.
Read the rest of this entry »
1 Comment |
algorithms, data structures, Mathematics, Object Oriented Programming, programming, Suggested Reading, theoretical computer science |
Permalink
Posted by Steven Pigeon
23/02/2010
Have you ever add to decide, you and your colleagues, where to go for lunch? Each time, it ends up being a committee, of course. It gets even worse when not only you have many colleagues, but also two offices, or two groups, at different locations. Since we work in a rather large city, we want to walk to the chosen restaurant, rather than drive, but in a way that is fair to either group.

So to settle the argument about where are the restaurants midway of both locations, we need a map, and some math.
Read the rest of this entry »
2 Comments |
algorithms, hacks, Life in the workplace, Mathematics, programming |
Permalink
Posted by Steven Pigeon
09/02/2010
Mathematics can ask you to remember things that have no obvious connection to common sense. Either because it’s arbitrary (the name of a function in respect to what it computes) or because you haven’t quite figured all the details out. In either cases, a few mnemonics are always useful!

Read the rest of this entry »
5 Comments |
hacks, Life, Mathematics, Zen | Tagged: cosine, Euler, hidari, mitsudomoe, mnemonics, Pi, Sine, sohcahtoa, tangent, trigonometry, unit circle |
Permalink
Posted by Steven Pigeon
29/12/2009
Let’s say we want to mix three channels onto two because the communication device has only two available channels but we still want to emulate a three channel link. If we can afford coding, then it’s not a problem because we can build our own protocol so add any number of channels using a structured data stream. But what if we cannot control the channel coding at all? In CDs, for example, there’s no coding: there are two channels encoded in PCM and a standard CD player wouldn’t understand the sound if it was encoded otherwise.
The solution is to mix the three channels in a quasi-reversible way, and in a way that the two channels can be listened to without much interference. One possible way is to mix the third channel is to use a phase-dependant encoding. Early “quadraphonic” audio systems did something quite similar. You can also use a plain time-domain “mixing matrix” to mix the three channels onto two. Quite expygeously, let us choose the matrix:
![M=\left[~\begin{array}{ccc} \frac{2}{3} &0&\frac{1}{3}\\ 0 &\frac{2}{3}&\frac{1}{3}\end{array}~\right]](https://s0.wp.com/latex.php?latex=M%3D%5Cleft%5B%7E%5Cbegin%7Barray%7D%7Bccc%7D+%5Cfrac%7B2%7D%7B3%7D+%260%26%5Cfrac%7B1%7D%7B3%7D%5C%5C+0+%26%5Cfrac%7B2%7D%7B3%7D%26%5Cfrac%7B1%7D%7B3%7D%5Cend%7Barray%7D%7E%5Cright%5D&bg=ffffff&fg=333333&s=0&c=20201002)
Read the rest of this entry »
1 Comment |
algorithms, data compression, Mathematics, Science, signal processing | Tagged: CD, channel mixing, least mean squares, least squares, linear algebra, linear regression, matrices, Matrix, mixing matrix, Moore-Penrose, PCM, pseudo-inverse, quadraphonic, rgb, surjection, surjective function |
Permalink
Posted by Steven Pigeon
22/12/2009
The other day—well, a year ago or so—I was invited to visit CBC’s digital TV studios in Montréal by the SMPTE Montréal. We were shown around, even in the somewhat small control rooms. Amongst all the displays, dials, monitors, and misc. blinkenlights, I noticed a small LCD display showing an hexagonal projection of the current show’s color gamut in
(or maybe
?), probably for quality assessment purposes. I thought it was pretty cool, actually.

Let’s see how we can realize this projection with as little CPU time as possible.
Read the rest of this entry »
1 Comment |
algorithms, bit twiddling, C, embedded programming, hacks, Mathematics, programming | Tagged: animated gif, blinkenlights, camel, CBC, colorspace, digital tv, DTV, folding, folding function, gamut, gif, pairing, pairing function, real time, realtime, realtime rendering, rgb, studio, tuple, tv studio, ycrcb |
Permalink
Posted by Steven Pigeon
15/12/2009
Building a decent personal library is not very difficult but it can be really expensive. It doesn’t have to, you just have to know where to look for.

Read the rest of this entry »
2 Comments |
algorithms, Books, Life, Mathematics, Science | Tagged: book shops, Dover, Used Books |
Permalink
Posted by Steven Pigeon
08/12/2009
Certain numbers keep showing up in nature. The Golden Ratio,

is one of them. It shows up in cats, sunflowers, and Egyptian pyramids.

Read the rest of this entry »
10 Comments |
hacks, Inoffensive Rant, Life, Mathematics | Tagged: Ancient Egypt, apophenia, archeology, Cat, Cats, Egypt, Giza, Gizeh, golden ratio, Golden Section, Great Pyramid, Kheops, numerology, Pet theory, Phi, Pyramids |
Permalink
Posted by Steven Pigeon