Friday, April 30, 2010


Can you pour exactly half of a mug of coffee from a mug filed to the brim?

Wednesday, April 28, 2010

Added a VectorSpace generator ...

Added a generator to the compressed vector space project. It's funny because I work on this coding just for the sake of coding. These are free coding sessions that I make at my favorite coffe shop in London from 8.15am to 9am.

People are telling me "so you work all the time". My point is that I do not consider this particular coding activity "a work". I make this just because is fun and just because I like it.

Studying, Coding is just fun. Fun like going to the gym ( or going to see a musical (9pm-..) don't you agree?

Tuesday, April 27, 2010

I like it a lot

The new feature allows any developer to drop a fairly simple piece of code into a site to create a two-way direct link with Facebook's network. If you have signed into Facebook, this third-party website will recognize who you are and feed anything you do there back into your Facebook profile.

Given Facebook's size and growth curve, it will be next to impossible for any major website to resist implementing the Open Graph. They simply cannot turn their back on the ability to leverage that massive an audience. All those users will be feeding their actions back to their Facebook friends, given the website's powerful viral promotion

Of course, it also means Facebook will control a treasure trove of information about you....

Monday, April 26, 2010

Finding the maximum sum in two sorted arrays

Given two sorted postive integer arrays A(n) and B(n) (let's say they are decreasingly sorted), we define a set S = {(a,b) | a \in A and b \in B}. Obviously there are n^2 elements in S. The value of such a pair is defined as Val(a,b) = a + b. Now we want to get the n pairs from S with largest values. in O(n).

Sunday, April 25, 2010

Number 6 and 7

If I give you 3 number 6, can you make a number 7?

Saturday, April 24, 2010

Sorted linked list into a binary search tree

Given a sorted lnked list construct a balanced binary search tree from it

Friday, April 23, 2010

Find the index of three numbers whose sum is closest to zero

given an array(unsorted) may contain negative numbers too, find the index of three numbers whose sum is closest to zero

Thursday, April 22, 2010

One in Four Countries Block Some Google Services

"Google's services are blocked or censored to some degree in one-fourth of the countries where it operates, the company said Monday."

Wednesday, April 21, 2010


Added art1 test to the compressed vector space. Here you have the code

Tuesday, April 20, 2010

Monday, April 19, 2010

62-63 = I

Can you move just one digit so that the above equation is correct?

Sunday, April 18, 2010

Ants and a segment

You have a segment with n ants over it. Each ant start to walk in a random chosen direction (right or left). When two ants collide they change the direction. What happens at the end?
Suppose that the ants move in a synchronous way. When it the end?

Saturday, April 17, 2010

Pages in a newspaper

You buy a newspaper and notice that page 8 and 21 are on the same sheet. Can you infer the total number of pages in the newspaper?

Friday, April 16, 2010

Set of intervals

Given a set of intervals and on interval i, return the set of all the intervals overlapping with i in optimal time

Wednesday, April 14, 2010

Number 2

How many numbers can you write by using 3 numbers 2 ?

Tuesday, April 13, 2010

Server allocation for different Online providers

Data is incomplete, but useful. Where is Microsoft, where is amazon, where is yahoo, etc?

Monday, April 12, 2010

Find the largest element in an interval

Given an array of n integers, find the k-th largest element in the interval [i, j]. Note that i, j, k are input parameters. What is the complexity.

Saturday, April 10, 2010

Yahoo+Microsoft +0.3, Google -0.4

Latest comscore for U.S. are out.

Microsoft's Bing scored the biggest increase, growing from 11.5 percent to 11.7 percent in March. Yahoo moved up slightly from 16.8 percent to 16.9 percent during the same period.

The Yahoo move is significant, if for no other reason than it stopped the six straight month losses in search share they experienced.

Google had the largest move, albeit downward, dropping from 65.5 percent search share to 65.1 percent.

Friday, April 9, 2010

Yahoo! to loose his CTO

Another yahoo executive left the company. This time the CTO. deja-vu.

Thursday, April 8, 2010

Random search in a random array, with duplicates

I already put this problem, but now assume that there are k elements with value x. What is the expected running time?

Suppose you have an array of random integers A[i] i = 0, ... , n-1. Suppose you adopt the following random search strategy for value x. Pick a random index i into A. If A[i] = x, then we terminate; otherwise, continue the search by picking a new random index into A. Note that we may examine a given element more than once.

Wednesday, April 7, 2010

Personal consideration about algorithms in Europe

Why I never went to U.S.? I love to _walk_ to the bar around the corner, having people that calls me by _name_. I love having my _coffe_ ready without ordering it, just because they know me. I love starting my day reading an algorithm book just sitting there with people around me while the City is waking up.

Tuesday, April 6, 2010

Ed Roberts, the father or modern PC died on April 1st

Henry Edward "Ed" Roberts (September 13, 1941 – April 1, 2010) was an American engineer, entrepreneur and medical doctor who designed the first commercially successful personal computer in 1975.[1] He is most often known as the "the father of the personal computer".[2] He founded Micro Instrumentation and Telemetry Systems (MITS) in 1970 to sell electronics kits to model rocketry hobbyists, but the first successful product was an electronic calculator kit that was featured on the cover of the November 1971 issue of Popular Electronics.[3] The calculators were very successful and sales topped one million dollars in 1973.[4]

A brutal calculator price war left the company deeply in debt by 1974. Roberts then developed the Altair 8800 personal computer that used the new Intel 8080 microprocessor. This was featured on the cover of the January 1975 issue of Popular Electronics, and hobbyists flooded MITS with orders for this $397 computer kit.

Bill Gates and Paul Allen joined MITS to develop software and Altair BASIC was Microsoft's first product. Roberts sold MITS in 1977 and retired to Georgia where he farmed, studied medicine and eventually became a small-town doctor.

Monday, April 5, 2010

AI Application Programming (Programming Series)

This is a good book, if you like to know a bit more about artificial intelligence with real programming examples in C.

Sunday, April 4, 2010

Saturday, April 3, 2010

Facebook and data privacy

From PeteSearch: "I'm sorry to say that I won't be releasing the Facebook data I'd hoped to share with the research community. In fact I've destroyed my own copies of the information, under threat of a lawsuit from Facebook.... ? From my conversations with technical folks at Facebook, there seems to be a real commitment to figuring out safeguards around the widespread availability of this data. They have a lot of interest in helping researchers find ways of doing worthwhile work without exposing private information."

Friday, April 2, 2010

February Search: Bing Gains at Yahoo's Expense

The major search engines continue their recent market share trend; Google capturing the lion’s share and steady, Bing continuing to gain ground while Yahoo! continues on its downward trend.

Thursday, April 1, 2010

Happy Birthday, Apple

Apple started 34 years ago. This was the IFirst, the first product ever releases.