Tuesday, March 28, 2017

Beauty of Algorithms

Optimal solution for a scheduling problem where there are n jobs (1,2,3,..,n) where a job i has a weight Wi, length Li. (0 < i <=n)
Prove that the optimal solution is to order the jobs in decreasing Wi/Li (proportional to weight or importance and inversely proportional to length).

Proof 1: (prove without ties, i.e Wi/Li are unique). Hint: Use exchange argument and contradiction

Proof 2: (prove even with ties, i.e Wi/Li may not be unique). Hint: Prove that greedy algorithm is at least as good as any other solution and note the bubble sort inside the proof argument.

Tuesday, March 20, 2012

The curious case of the American justice system

The Florida shooting case has left a lot of people seething over the way the law appears to be protecting a guy who brazenly shot an unarmed kid in the name of "self defense" and "standing one's ground". Today I stumbled upon another article in the NYT that talks about a diametrically different aspect of the American justice system - the large number of people incarcerated in US jails. The first line in the article summarizes the gist neatly:

'The United States has less than 5 percent of the world's population. But it has almost a quarter of the world's prisoners.'

I was struck by the absurd irony here. Reading the first story could make you think that hardly anybody - even somebody who brazenly follows an unarmed black kid and shoots him dead - goes to jail. The second story on the other hand paints a completely different picture. What gives?

Saturday, March 17, 2012

Adam Smith on executive compensation on Wall Street

Well not exactly.. but the great man did pen something regarding the wages of goldsmiths and jewellers who would be the rough equivalent of Wall St traders and execs today:

"The wages of goldsmiths and jewellers are everywhere superior to those of many other workmen, not only of equal, but of much superior ingenuity, on account of the precious materials with which they are intrusted.

We trust our health to the physician: our fortune and sometimes our life and reputation to the lawyer and attorney. Such confidence could not safely be reposed in people of a very mean or low condition. Their reward must be such, therefore, as may give them that rank in the society which so important a trust requires. The long time and the great expense which must be laid out in their education, when combined with this circumstance, necessarily enhance still further the price of their labour."

Ref: The Wealth of Nations by Adam Smith: Chapter 10: Of Wages and Profit in the different Employments of Labour and Stock

It is interesting to observe that even during Smith's time, the rationale for higher wages for certain classes of people were predicated more on intangibles (e.g trust) rather than on actual economic output or results. The unfortunate aspect is that these intangibles still matter a lot today - people trust a Phd on Wall Street to be better at investing other people's money but the evidence, especially the financial ruin brought about by unregulated activity clearly suggests otherwise.

Friday, May 7, 2010

Monetary Unions

There can be no such thing as a perfect OCA but the US probably comes closest to it. If the US carves out monetary unions there will be a price to pay (since each state now needs a central bank and so on) that could very well outweigh the flexibility of having different currencies. Africa is another interesting case: because it has multiple currencies, the flexibility has resulted in relatively prosperous countries like Botswana, Namibia and South Africa while at the same time a few countries are at the other end of the spectrum. If Africa adopted a common currency, the living standards in the prosperous countries would tend to go lower because there would always be a transfer of wealth from the richer countries to poorer countries to maintain the common currency (exactly what Germany is being forced to do for Greece).
India is probably the best example of a country that roughly has a US like system but is worse off with a single currency because underneath it is more Europe like heterogeneity rather than US like homogeneity. The more developed economies of Bangalore, Mumbai subsidize the poorer economies of much of the rest of the regions in the country.