Sometimes computer science, IT or electronic and communication engineering students get placed in two or three major Indian IT companies and they find it hard to decide which one to join. "Infosys, TCS, or Wipro?" is one of the most common questions I have faced from such students. The answer is much simpler than they think it is.

"None."

This blog post is not about how these companies feed the stomachs of lakhs of people. This blog post is not about undermining the efforts of these companies. They are probably good at keeping their customers happy. This blog is not about offending the employees of these organizations. That'll be an unintentional side-effect.

This blog post is about a choice that freshers usually have to make and the information they should have before they make the choice. This blog post is about urging the freshers who want to make a career in engineering to not make a mistake that I did because I did not have the necessary information at the right time; a mistake that I could correct two years later after I realized it. This blog post is about some very unpleasant facts about these major Indian IT companies that you wouldn't know unless you have been a part of it.

ALERT: If you are not interested in making a career in engineering, lack the confidence to do so, or you are very content with working for one of these three companies for reasons that are valid to you, this post is not for you. It won't make any sense to you. Do not proceed.

Now, let me start slaying the different myths that exist about these organizations one by one and I am not going to mince words while doing this. You have been warned.

  1. Training: People think that these organizations are good for freshers because they get a lot of training which they wouldn't get in other organizations. I must remind such people that attending training programmes is not equivalent to learning. Indeed these organizations provide a lot of training to freshers but only about 1% of the trainees actually absorb the knowledge. The 1% that do absorb the training do not stick to the organization for a long time because sooner or later they realize that they want to do some real engineering. The figure '1%' isn't merely a guess. This is my observation across various trainee-batches that have been trained in one of these organizations. Think about it. Can you learn a new programming language in just 3 days? If your answer is "no", you shouldn't join one of these organizations. If your answer is "yes", you shouldn't join one of these organizations.
  2. Engineering: One can find engineering problems in these organizations but no trace of engineering. For those of you who work in one of these organizations and are offended by this statement, please go and open your engineering textbooks again. Try to remind yourself what you studied and what you learnt. Consider what you do now.
  3. Engineers: The number of engineers in these organizations are very very few; perhaps only 1 in every 200 is an engineer. This is a guess, albeit not a wild one. This is why there is no engineering in these companies despite the presence of engineering problems. "But isn't the minimum qualification to get a job in one of these organizations bachelor's of engineering?", you might ask. It is. Yes, all of them have a degree in engineering or computers of some sort but only about 1 out of 200 is an engineer. The rest 199 do not understand why a bitcount of 1's complement of bitwise XOR of two variables would give you the number of similar bits in corresponding positions in both variables, why one can not create a POSIX compliant regular expression to match only strings with balanced parentheses, or how to find the shortest chain of connections between two friends in a social network. Note that I have used 'or' as the conjunction and not 'and'. They may be good software users or good "software-tailors" who can create software by stitching together many library functions but they aren't engineers.
  4. Culture: One of the worst cultures you can find in the whole of software industry. Very few are busy trying to learn a few things mentioned in the previous paragraph. Some employees are busy figuring out ways to impress their female colleagues using the resources provided by the organization rather than learning and solving problems in better ways. Others are busy cribbing. Here is a shocking piece of information for those who have never worked for one of these organizations. One can also manage to find mud-slinging in company forums once in a while. Professionalism is at its worst here. But they convince themselves that they are professional because they speak English fluently and know how to wear a tie. Employees feel their salaries are pathetic. I feel they are overpaid. How much should a good software user earn?
  5. Onsite: Contrary to the popular belief, the number of trips to foreign lands isn't a measure of one's technical prowess. It is mostly (but not always) a measure of how dispassionate one is about engineering and his profession, and how greedy one can be for wealth. Some of the best engineers I have met in these organizations were never eager to go onsite, never went, joined an organization where they could put their knowledge and skills to better use and then flew to a foreign land because their knowledge, skills and understanding of technology were needed there.

So, my answer to the question "Infosys, TCS, or Wipro?" is "None." That's not very helpful. Here is a more helpful one. One can consider applying for a job in an organization where he or she can get an opportunity to solve some engineering problems. One cannot learn engineering and programming merely by attending trainings. One has to learn it by doing, solving problems, observing what experienced engineers do, experimenting, screwing up a few times and reworking, talking to good engineers, etc. One can try looking for an organization where the leaders of projects are very good engineers. Start-ups are more likely to have them. Some matured ones are Gluster, Parallocity, SlideShare, etc. New start-ups come up every year. Software companies which develop famous and successful products are more likely to have them. Some good examples are Adobe, Amazon, Google, Phoenix, etc. So, how does one figure whether a certain organization is an organization of engineers or an organization of good software users?

The clue is: Interview.

Remember the questions they ask in the interview. Think about them later. Try discussing the questions with your friends who are known for solving tough engineering problems. An interview is not only an opportunity for an organization to evaluate an applicant, it is also an opportunity for the applicant to evaluate an organization.

Update: October 28, 2011: This post got way more attention than I wanted. It was discussed and debated at various places on the web. As a result, here is a follow-up post: Re: Infosys, TCS, or Wipro?

I was studying in the 1st standard. Our science teacher gave us a surprise test. I tried to answer all questions correctly. After the corrected notebooks were returned, I found that the teacher had incorrectly marked one of my answers as incorrect. I was sure that I was correct. So, I showed it to the girl sitting next to me and declared innocently, "This answer is correct. But she doesn't know. She is stupid."

When she went to collect her notebook, she informed the teacher about what I had just said. The teacher was offended and asked me to stand outside the class. Our principal was passing through the corridor and she was surprised to see me standing outside. She asked what I did and I said that I called our teacher stupid. She asked me to apologize.

I didn't know how to do that. I started recollecting from Hindi movies. The villian would fall at someone's feet and cry, "Mujhe maaf kar do. Please, mujhe maaf kar do."[*] I thought, "I can't do this. I can't fall at her feet. That would be very embarrassing. I said that she was stupid and I was right. Why should I fall at her feet?" I refused to apologize, inspite of repeated warnings and requests. I was simply not ready to fall at her feet and do the drama.

The matter escalated and I was asked to leave that place. I was taken to the reception area. I was not allowed to attend any classes. I sat there crying the whole day. Visitors came and enquired why I was crying. I explained. Before the final bell rang, a complaint was registered in my diary and my parents were asked to meet the principal next day.

The next day, my parents met the principal. Thankfully, it went well. She explained how she was impressed with my innocence and honesty. It seemed as if she had called my parents only to praise me. I grew up to be wiser and humbler. Now, I understand that falling at someone's feet is not the only way to apologize.

[*] Translated to English: "Forgive me. Please, forgive me."

A colleague asked this problem.

A perfect riffle shuffle or bridge shuffle is when we split a deck of cards into two halves (one in each hand), and then alternately drop one card from each half till all have fallen. For the sake of this problem, let us assume that the top card will always be the top card and the bottom card will always be the bottom card after shuffling. However the rest of the cards will be deranged.

How many such riffle shuffles do we need to perform on a deck of 52 cards, in order to obtain the exact same starting order?

Such a style of shuffling is also known as out shuffle.

Let us assume that there are 2n cards where n is a positive integer. Let us number the positions of the cards as 0, 1, … 2n − 1 where position 0 is the top of the deck and position 2n − 1 is the bottom of the deck. Here is an example with 10 cards called c0, c1, … c9 with positions indicated in the first column.

0. c0                     c0
1. c1                     c5
2. c2                     c1
3. c3                     c6
4. c4 ———> Shuffling ———> c2
5. c5                     c7
6. c6                     c3
7. c7                     c8
8. c8                     c4
9. c9                     c9
Let us consider a card at position k where 0 ≤ k < 2n. It is easy to see from the description of the problem that a card at position k moves to position 2k if the card belongs to the top half of the deck, otherwise it moves to 2(k − n) + 1.

2(k − n) + 1 ≡ 2k − (2n − 1) ≡ 2k (mod 2n − 1)

So, we can say that a card at position k moves to position k' ≡ 2k mod (2n − 1) after an out shuffle where 0 ≤ k' < 2n.

So, after m shuffles a card at position k moves to position k` ≡ 2m · k (mod 2n − 1) where 0 ≤ k` < 2n. So, we are looking for the smallest positive integer m such that for all integers k, where 0 ≤ k < 2n,

2m · k ≡ k (mod 2n − 1)

Removing k from both sides we get

2m ≡ 1 (mod   (2n−1)gcd(k, 2n−1))

For simplicity, let us represent (2n−1)gcd(k, 2n−1)) as Fnk. So, a card at position k returns to the same position after m out shuffles where m is the smallest positive integer that satisfies the congruence relation

2m ≡ 1 (mod Fnk)

Since 2n − 1 is odd, Fnk must be odd. So, gcd(2, Fnk) = 1. The smallest positive integer m that satisfies the congruence relation above is known as the multiplicative order of 2 modulo Fnk and is denoted as ordFnk(2).

If n = 1, Fnk = 1 and 2m ≡ 1 (mod Fnk) is true for all positive integers m. So, with two cards, an out shuffle doesn't change the positions of the cards.

If n > 2, let us consider a k which is coprime to 2n − 1 and 1 < k < 2n − 1. There exists at least one such k because φ(x) ≥ 2 for x > 2 where φ(x) is the Euler's totient of a positive integer x which is defined as the number of positive integers less than or equal to x that are coprime to x. Now, gcd(k, 2n − 1) = 1. So, now the congruence relation

2m ≡ 1 (mod   (2n−1)gcd(k, 2n−1))

reduces to

2m ≡ 1 (mod 2n − 1)

So, far we understand that after ord2n−1(2) out shuffles, any card at a position number coprime to 2n − 1 would be back to its original position. What about cards at other positions?

For a card at position k such that k is not coprime to 2n − 1, gcd(k, 2n − 1) ≠ 1. In this case the number of out shuffles required to bring the card at its original position is ordFnk2.

2ord2n−1(2) ≡ 1 (mod 2n − 1) ⇒ 2ord2n−1(2) ≡ 1 (mod Fnk) … (since Fnk | 2n − 1)

As a consequence of Lagrange's theorem, ordFnk(2) | ord2n−1(2).

In other words, ord2n−1(2) = c · ordFnk(2) for some positive integer c.

So, performing ord2n−1(2) out shuffles is same as repeating ordFnk(2) out shuffles c times. Every ordFnk(2) shuffles brings back the card at position k to the same position. So, repeating it c times would leave it at the same position as well.

Hence, we conclude that ord2n−1(2) out shuffles would restore a deck of 2n cards to its original configuration, where n is a positive integer.

For a deck of 52 cards, n = 26. So, ord51(2) out shuffles would restore the deck to its original configuration.

Let us compute ord51(2).

From Carmichael's theorem, 2λ(51) ≡ 1 (mod 51), where λ(n) is the smallest positive integer m such that am ≡ 1 (mod n) for every positive integer a coprime to and smaller than n.

λ(51) = lcm(λ(3), λ(17)) = lcm(2, 16) = 16.

Again as a consequence of Lagrange's theorem, ord51(2) | λ(51). In other words, ord51(2) | 16.

Let us check all the factors of 16 and see which one is the multiplicative order of 2 modulo 51.

22 ≡ 4 (mod 51) 24 ≡ 16 (mod 51) 28 ≡ 256 ≡ 1 (mod 51).

∴ ord51(2) = 8.

8 is the answer.

Let me share a little experiment I did last night. Listen to the following audio first. This plays a sine wave of 500 Hz for 2 seconds followed by another sine wave of 500.1 Hz for 2 more seconds. You can hear a tick after each second. The 500.1 Hz sine wave starts at the second tick.

Could you notice any difference in the pitch of the two tones? The difference in the frequencies is so small that you wouldn't be able to notice it by hearing.

Now, let us see what happens when we superimpose both the waves and listen to it.

You would notice that the loudness decreases rapidly at about 5 seconds and then returns to full volume by 10 seconds, decreases rapidly again at 10 seconds and returns to full volume by 15 seconds and so on. In other words, the loudness decreases every 10 seconds.

Let us see why this happens from the graph of the waves. The first wave can be represented with the function f(t) = 0.4 sin (2π · 500 · t) and the second one with g(t) = 0.4 sin (2π · 500.1 · t)

At t = 0 seconds, both the waves look very similar. The crests and troughs of both the waves appear almost simultaneously. On superposition, the amplitude almost doubles. The graph of the superimposed waves is shown below. Note that the amplitude of each wave in the figure above is 0.4 while that of superimposed waves is almost 0.8 as can be seen below. In fact, it is exactly 0.8 at t = 0 seconds and then gradually decreases in the region 0 < t < 5.

The time period of the second wave is slightly shorter than the first one as the frequency of the second wave is slightly greater than the first one. So, the two waves are not identical. In fact, the second wave looks like a very slightly compressed form of the first wave. At about t = 5 seconds, the difference is obvious.

The crests and troughs of both the waves do not appear simultaneously at around t = 5 seconds. In fact, the crest of one wave and the trough of the other wave appear simultaneously. This cancels out each other on superposition and thus the resultant wave has almost no amplitude at this time.

The amplitude is exactly 0 at t = 5 seconds and it increases gradually till t = 10 seconds. At t = 10 seconds, the amplitude becomes 0.8 again and then starts decreasing till t = 15 seconds when it becomes 0 again. This cycle continues. This can be seen in the graph of the superimposed waves given below.

Let us understand this mathematically. Let us represent both the sine waves with the functions: y1 = A sin 2πft and y2 = A sin 2π(f + Δf)t, where A is the amplitude of the waves, and f and f + Δf are the frequency of the two waves.

So, the superimposed waves can be represented as

y1 + y2

= A sin 2πft + A sin 2π(f + Δf)t

= (2A cos 2π · Δf2 · t) sin 2π(f + Δf2)t

To understand this function intuitively, imagine it as a sine wave with a frequency of f + Δf2 and an amplitude of 2A cos 2π · Δf2 · t. In our case, f + Δf2 = 500.5 Hz. So, the superimposed waves look like a sine wave with a frequency of 500.5 Hz but with its amplitude varying with time at a frequency of Δf2. In other words, the amplitude oscillates between 0 and 2A every 1Δf seconds. Since Δf = 0.1 Hz and A = 0.4 in our case, we see that the amplitude of the 500.5 Hz sine wave oscillates between 0 and 0.8 every 10 seconds.

Flowers is my third attempt at composing music. I composed, played and recorded it last year but I scribbled it down and prepared the sheet music today. Hence, this blog post today.

The links to the audio files, sheet music, etc. are provided below. The files reside in my website. In case, my website is down, the YouTube link provided below should still work.

This piece consists of 161 measures. It is approximately 3 minutes 8 seconds long.

This piece of music embodies love, peace and joy. After I composed the first few notes and played it, someone told me that the notes bring an image of flowers in the mind. Most of the music emerged naturally from my mind. Some of the bass notes did not come out naturally and I decided them, quite artificially, to fill the music with a pleasant and peaceful mood. It took me a couple of days to compose this. I played and recorded this after a day of practice.

RSS