Hot Manju Bhabhi Showing Cleavage










Algorithms for Interviews
Let's begin with the picture on the front cover of the book, reproduced on the right. You may have observed that the portrait of Alan Turing is constructed from a number of pictures ("tiles") of great computer scientists and mathematicians.
Suppose you were asked in an interview to design a program that takes an image and a collection of s X s-sized tiles and produce a mosaic from the tiles that resembles the image. A good way to begin may be to partition the image into s X s-sized squares, compute the average color of each such image square, and then find the tile that is closest to it in the color space. Here distance in color space can be the Euclidean distance over Red-Green-Blue (RGB) intensities for the color. As you look more carefully at the problem, you might conclude that it would be better to match each tile with an image square that has a similar structure. One way could be to perform a coarse pixelization (2 X 2 or 3 X 3) of each image square and finding the tile that is "closest" to the image square under a distance function defined over all pixel colors (for example, Euclidean Distance over RGB values for each pixel). Depending on how you represent the tiles, you end up with the problem of finding the closest point from a set of points in a k-dimensional space.
If there are m tiles and the image is partitioned into n squares, then a brute-force approach would have O(m n) time complexity. You could improve on this by first indexing the tiles using an appropriate search tree. A more detailed discussion on this approach is presented in the book