Pages

Thursday, December 25, 2008

Code to find the middle element in a singly linked list.

Programming language used: C/C++

node* FindMiddle(node *head, node** middle)
{
if(!head || !(*middle))
return;
node* slow = head;
node* fast = slow->next;
while (fast && fast->next)
{
slow = slow->next;
fast = fast->next->next;
}

*middle = slow->next;
return slow;
}

Tuesday, December 16, 2008

Gmail sending anonymous user account details

I went ahead and created a new user in gmail. And when I login for the first time, I see an unread email that states some anonymous user was created. Some user probably created a new email at the same time and that info. was passed to me?

Friday, December 12, 2008

Land of Gandhigiri ?

A trip to India after two years; with expectations of not many changes, yes my country did not disappoint me. The only shocking change to me was the skyrocketing inflation, which put the commoners under pressure for their daily bread.

Well it was rejoicing to meet friends and family after a long time. But there were some pinches which I would like to discuss, and that’s the whole point of this post.

In the west you are used to treat everyone with more or less with the same respect and attitude. The difference is huge in India; this is not something new as we know. But what happens when you try to show the same mentality of equal respect and attitude towards people in India, I happened to encounter several occasions where I was feeling that I’m the one left behind with setback. I can quote some example(s) to plot the frame in your mind.

I went in to a restaurant with my friends for dinner, for the first time I felt that my friends were rustic. The way my friends treated the waiters and service men of the restaurant, was hurting my feelings. My friend would say, “Bring this dish immediately”, “won’t you tell beforehand this dish is going to take so long to prepare”, “Make it fast”, and all this with the body language, for which I have no excuses. I didn’t want to comment on this act, as I felt I would be cornered by saying look at this bugger from the USA.

As a next example, I go in to dine with my relatives and the same experience; even worse. I was just holding my words and waiting to tell them not to play bosses.

But the worse stuff is when I tried to be a polite and nice guy. I would go by “Please, Thank you” and with due respect and patience for the service men to answer. I would listen and respond when I get my turn and make them comfortable by my words; so as not to trickle the feeling of servility in them. In return what I got was an improper response; they did not mind listening to me. But they did quick and good service for those who show the bossy attitude towards them. I could not stop getting frustrated couple of times, as I expected a good service in return for the way I treated. I was told to wait for a long time; as I saw the dishes going to the nearby tables, which was occupied only later. I was even convincing myself what if the nearby tables were advance bookings, but I confirmed that they were not. I spoke to couple of auto rickshaw men by being a polite and nice guy, for what I was taken for granted and fooled with more service charges.

My thought, why didn’t people respond properly as I expected, is something wrong in the society and system? If I recall the Indian history correctly, we were ruled for over 200 – 300 years by the Mughals and later by the British. This had changed our mindset to behave the way we are today, with servile attitude.

I wouldn’t again generalize this (knew only some of you could be in consensus with me), as there have been tremendous changes in the attitude of the Indian people, but there is lots more left to change.

As the land of Gandhigiri people should realize that love should be the force and the language of communication for the day today things to work.