Foiled!

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.

QuickSort Animation (Source: Wikipedia)

Indeed, there are occasions where QuickSort leaves its expected O(n \lg n) run-time to reach O(n^2) run-time, its worst case. But what does it take to push QuickSort into its worst behaviour?

Read the rest of this entry »


Suggested Reading: Algorithms for Memory Hierarchies

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 »


Suggested Reading: Advanced Data Structures

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 »


Computing the Neutral Zone

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 »


Sohcahtoa!

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 »


Channel Mixing and Pseudo-Inverses

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]

Read the rest of this entry »


Lost+Found: Ghostly Geometry

22/12/2009

Lusine – “Two Dots” from Ghostly International on Vimeo.


Live Video Color Gamut

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 YC_rC_b (or maybe YP_bP_r?), probably for quality assessment purposes. I thought it was pretty cool, actually.

example-cropped

Let’s see how we can realize this projection with as little CPU time as possible.

Read the rest of this entry »


Building a Personnal Library (part I)

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.

book_stack

Read the rest of this entry »


Cats, Pharaohs, and the Golden Ratio

08/12/2009

Certain numbers keep showing up in nature. The Golden Ratio,

\phi \approx \displaystyle\frac{1+\sqrt{5}}{2}

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

hiero-cat

Read the rest of this entry »