Author: rahul

  • Sentence in which nth Word has n letters

    “I do not know where family doctors acquired illegibly perplexing handwriting, nevertheless extraordinary pharmaceutical intellectuality counterbalancing indecipherability, transcendentalises intercommunications’ incomprehensibleness.”

    -> A sentence where nth word is n letters long.

  • Montly Hall Problem

    THE MONTY HALL PROBLEM
    This story is true, and comes from an American tv game show. Here is the situation. Finalists in a tv game show are invited up onto the stage, where there are three closed doors. The host explains that behind one of the doors is the star prize – a car. Behind each of the other two doors is just a goat. Obviously the contestant wants to win the car, but does not know which door conceals the car.

    The host invites the contestant to choose one of the three doors. Let us suppose that our contestant chooses door number 3. Now, the host does not initially open the door chosen by the contestant. Instead he opens one of the other doors – let us say it is door number 1. The door that the host opens will always reveal a goat. Remember the host knows what is behind every door!

    The contestant is now asked if they want to stick with their original choice, or if they want to change their mind, and choose the other remaining door that has not yet been opened. In this case number 2. The studio audience shout suggestions. What is the best strategy for the contestant? Does it make any difference whether they change their mind or stick with the original choice?

    Scroll down in case you are confused on the solution.

    The answer to this question is not intuitive. Basically, the theory says that if the contestant changes their mind, the odds of them winning the car double. And over many episodes of the tv show, the facts supported the theory – those people that changed their mind had double the chance of winning the car.

    Why should this be so? After all, the contestant doesn’t know which door the car is behind, and so the chance of the car being behind any one particular door is one third, isn’t it? So surely the chance of winning the car if they stick with their original choice is one third, and the chance of winning the car if they change their mind is also one third? How can the odds double?

    The answer goes like this. When the contestant makes their first choice, the chance of them being correct is indeed one in three, or one third. And if, after the host has done his patter and opened another door, they stick with their original choice, then their chance of being correct is unaltered, it is one third. Indeed, how could this possibly change?

    This is an old mathematical puzzle, and has been published in probability textbooks for over 100 years. However, as we said, it is counter-intuitive, and the maths that most people do in school does not cover this.

    This is not an example of simple probability (suppose there are two doors, therefore there is a 1 in 2 chance of the car being behind either of the doors). This is an example of conditional probability: what is the chance of something happening, given that something else already has.

    OK, so how does this puzzle work? Here is one way of explaining it. Let us assume that our contestant has chosen door 3. And let us assume that our contest never changes their mind. There are three equally likely possibilities-

    Door 1
    Door 2
    Door 3

    car
    goat
    goat
    lose

    goat
    car
    goat
    lose

    goat
    goat
    car
    win

    In one case out of three, the contestant will win the car. The green background shows the door that the host opened. Only in the last case did he have a choice, when he could have opened either door 1 or door 2.

    Now let us consider what happens if the contestant always changes their mind. Again they initially pick door 3.

    Door 1
    Door 2
    Door 3

    car
    goat
    goat
    win

    goat
    car
    goat
    win

    goat
    goat
    car
    lose

    Their chance of being right initially is still only 1 in 3. But now in both the first two cases the host opens a door revealing a goat, and the contestant changes their mind – and 2 times out of 3 they will be right.

    So, if the contestant sticks with their original choice, they will win the car 1 time in 3, and if they switch doors, they will win the car 2 times in 3.

    Here is another way of thinking about it. Imagine there are 100 doors, with a car behind only 1 of them. You choose a door. Your chance of being right is 1 in 100, right? Now the host opens 98 of the remaining 99 doors, in each case revealing a goat. You can now either stick with your original choice, or you can switch to the one remaining door that is closed. We say if you stick with your original choice, you still have a 1 in 100 chance of being right. And if you switch, you have a 99 in 100 chance of being right.

  • A nice poem

    Gone are the days……..but not the memories
    Gone are the days
    When the school reopened in June,
    And we settled in our new desks and benches.
    Gone are the days
    When we queued up in book depot,
    And got our new books and notes.
    Gone are the days
    When we wanted two Sundays and no Mondays, yet
    Managed to line up daily for the morning prayers.
    Gone are the days
    When we chased one another in the corridors in Intervals,
    And returned to the classrooms drenched in sweat.
    Gone are the days
    When we had lunch in classrooms, corridors,
    Playgrounds, under the trees and even in cycle sheds.
    Gone are the days
    When a single P.T. period in the week’s Time Table, Was awaited more
    eagerly than the monsoons.
    Gone are the days
    Of fights but no conspiracies,
    Of Competitions but seldom jealousy.
    Gone are the days
    When we used to watch Live Cricket telecast,
    In the opposite house in Intervals and Lunch breaks.
    Gone are the days
    When few rushed at 5:30 to
    “Conquer” window seats in our School bus.
    Gone are the days
    Of Sports Day, and the annual School Day,
    And the one-month long preparations for them.
    Gone are the days
    Of the stressful Quarterly, Half Yearly and Annual Exams,
    And the most enjoyed holidays after them.
    Gone are the days
    We learnt, we enjoyed, we played, we won, we lost, We laughed, we cried,
    we fought, we thought.
    Gone are the days
    With so much fun in them, so many friends,
    So much experience, all this and more.
    Gone are the days
    But not the memories, which will be
    Lingering in our hearts for ever and ever and
    Ever and ever and Ever.

  • Intereseting C Program

    This C program won the first prize in International obfuscated C code
    contest (IOCCC) held recently.It is amazing. My friend sent it to me this morning. I felt that, it’s better to pass it on to you. Answer is given down. But, try to guess the output yourself before watching the answer down. Here it goes…..

    #include
    main(t,_,a)
    int t;
    char _;
    char *a;
    {return!0

  • Line of Fire

    We say that we are hardworking . working 16 Hrs a day, stressing our brains and minds, we deserve a high pay package etc.. sitting in the AC , typing abcd, complaining about the canteen food

    RUBBISH!!!!!!!!!!!
    ……………………….

    Vivek Pradhan wasn’t a happy man. Even the plush comfort of the First Class air-conditioned compartment of the Shatabdi Express couldn’t cool his frayed nerves. He was the Project Manager and entitled to air travel. It was not the prestige he sought, he had tried to reason with the admin guy, it was the savings in time. A PM had so many things to do! He opened his case and took out the laptop, determined to put the time to some good use.

    “Are you from the software industry sir,” the man beside him was staring appreciatively at the laptop.
    Vivek glanced briefly and mumbled in affirmation, handling the laptop now with exaggerated care and importance as if it were an expensive car. “You people have brought so much advancement to the country sir. Today everything is getting computerized.”

    ‘Thanks,” smiled Vivek, turning around to give the man a detailed look. He always found it difficult to resist appreciation. The man was young and stocky like a sportsman. He looked simple and strangely out of place in that little lap of luxury like a small town boy in a prep school. He probably was a Railway sportsman making the most of his free traveling pass. “You people always amaze me,” the man continued, “You sit in an office and write something on a computer and it does so many big things outside.”

    Vivek smiled deprecatingly. Naivety demanded reasoning not anger. “It is not as simple as that my friend. It is not just a question of writing a few lines. There is a lot of process that goes behind it.” For a moment he was tempted to explain the entire Software Development Lifecycle but restrained himself to a single statement. “It is complex, very complex.”

    “It has to be. No wonder you people are so highly paid,” came the reply. This was not turning out as Vivek had thought. A hint of belligerence came into his so far affable, persuasive tone. “Everyone just sees the money. No one sees the amount of hard work we have to put in.” “Hard work!” “Indians have such a narrow concept of hard work. Just because we sit in an air-conditioned office doesn’t mean our brows don’t sweat. You exercise the muscle; we exercise the mind and believe me that is no less taxing.”

    He had the man where he wanted him and it was time to drive home the point. “Let me give you an example. Take this train. The entire railway reservation system is computerized. You can book a train ticket between any two stations from any of the hundreds of computerized booking centers across the country. Thousands of transactions accessing a single database at a given time; concurrency, data integrity, locking, data security. Do you understand the complexity in designing and coding such a system?” The man was stuck with amazement, like a child at a planetarium. This was something big and beyond his imagination. “You design and code such things.”

    “I used to,” Vivek paused for effect, “But now I am the project manager,” “Oh!” sighed the man, as if the storm had passed over, “so your life is easy now.” It was like being told the fire was better than the frying pan. The man had to be given a feel of the heat. “Oh come on, does life ever get easy as you go up the ladder. Responsibility only brings more work. Design and coding! That is the easier part. Now I don’t do it, but I am responsible for it and believe me, that is far more stressful. My job is to get the work done in time and with the highest quality. And to tell you about the pressures! There is the customer at one

    end always changing his requirements, the user wanting something else and your boss always expecting you to have finished it yesterday.”

    Vivek paused in his diatribe, his belligerence fading with self-realisation. What he had said was not merely the outburst of a wronged man, it was the truth. And one need not get angry while defending the truth. “My friend,” he concluded triumphantly, “you don’t know what it is to be in the line of fire.”

    The man sat back in his chair, his eyes closed as if in realization. When he spoke after sometime, it was with a calm certainty that surprised Vivek. “I know sir, I know what it is to be in the line of fire,” He was staring blankly as if no passenger, no train existed, just a vast expanse of time. “There were 30 of us when we were ordered to capture Point 4875 in the co ver of the night. The enemy was firing from the top. There was no knowing where the next bullet was going to come from and for whom. In the morning when we

    finally hoisted the tricolor at the top only 4 of us were alive.” “You are a…”

    “I am Subedar Sushant Singh from the 13 J&K Rifles on duty at Peak 4875 in Kargil. They tell me I have completed my term and can opt for a land assignment. But tell me sir, can one give up duty just because it makes life easier. On the dawn of that capture one of my colleagues lay injured in the snow, open to enemy fire while we were hiding behind a bunker. It was my job to go and fetch that soldier to safety. But my captain refused me permission and went ahead himself. He said that the first pledge he had taken as a

    Gentleman Cadet was to put the safety and welfare of the nation foremost followed by the safety and welfare of the men he commanded. His own personal safety came las t, always and every time. He was killed as he shielded that soldier into the bunker. Every morning now as I stand guard I can see him

    taking all those bullets, which were actually meant for me. I know sir, I know what it is to be in the line of fire.”

    Vivek looked at him in disbelief not sure of his reply. Abruptly he switched off the laptop. It seemed trivial, even insulting to edit a word document in the presence of a man for whom valor and duty was a daily part of life; a valor and sense of duty which he had so far attributed only to epical heroes.

    The train slowed down as it pulled into the station and Subedar Sushant Singh picked up his bags to alight.
    “It was nice meeting you sir.” Vivek fumbled with the handshake. This was the hand that had climbed
    mountains, pressed the trigger and hoisted the tricolor. Suddenly as if by impulse he stood at attention, and his right hand went up in an impromptu salute. It was the least he felt he could do for the country.

    PS: The incident he narrates during the capture of Peak 4875 is a true life incident during the
    Kargil war. Major Vikram Batra sacrificed his life while trying to save one of the men he commanded, as victory was within sight. For this and his various other acts of bravery he was posthumously awarded the Param Vir Chakra – the nation’s highest military award.

  • Why Me?

    Arthur Ashe, the legendary Wimbledon player was dying of AIDS.
    One of his fans asked him:

    “Why does GOD have to select you for such a bad disease”?

    Arthur Ashe replied:

    All over the world —

    5 crore children start playing tennis,

    50 lakh learn to play tennis,

    5 lakh learn professional tennis,

    50,000 come to the circuit,

    5000 reach the grand slam,

    50 reach Wimbeldon,

    4 to semi final,

    2 to the finals,

    When I was holding a cup I never asked GOD “Why me?”.

    And today in pain I should not be asking GOD “Why me?”

    Happiness keeps u Sweet, Trials keep u Strong,

    Sorrow keeps u Human , Failure Keeps u Humble,

    Success keeps u Glowing,

    But only God Keeps u Going.

  • Interesting Questions

    ———————————
    Recently Procter & Gamble India had participated in
    IIM-Bangalore’s Placement
    Sessions. They asked some interesting questions to
    students during recruitment.
    Here are some of them:-
    *********************************
    1. There is one word in the English language that is
    alway pronounced
    incorrectly. What is it?
    2. A man gave one son 10 cents and another son
    was given 15 cents. What time is it?
    3. A boat has a ladder that has six rungs, each rung
    is one foot apart. The
    bottom rung is one foot from the water. The tide rises
    at 12 inches every
    15 minutes. High tide peaks in one hour. When the tide
    is at it’s highest,
    how
    many rungs are under water?
    4. There is a house with four walls. Each wall faces
    south. There is a
    window in each wall. A bear walks by one of the
    windows. What color is the
    bear?
    5. Is half of two plus two equal to two or three?
    6. There is a room. The shutters are blowing in. There
    is broken glass on
    the floor. There is water on the floor. You find
    Sloppy dead on the floor.
    Who is Sloppy? How did Sloppy die?
    7. How much dirt would be in a hole 6 feet deep and 6
    feet wide that has
    been dug with a square edged shovel?
    8. If I were in Hawaii and dropped a bowling ball in a
    bucket of water
    which is 45 degrees F, and dropped another ball of the
    same weight, mass, and
    size in a bucket at 30 degrees F, both of them at the
    same time, which ball
    would hit the bottom of the bucket first? Same
    question, but the location
    is in
    Canada?
    9. What is the significance of the following: The year
    is 1978, thirty-four
    minutes past noon on May 6th.
    10. If a farmer has 5 haystacks in one field and 4
    haystacks in the other
    field, how many haystacks would he have if he combined
    them all in the
    center field?
    11. What is it that goes up and goes down but does not
    move?
    Scroll down for answers…………
    *
    *
    *
    *
    *
    *
    *
    *
    *
    *
    *
    *
    *
    *
    *
    *
    *
    *
    *
    *
    *
    *
    *
    *
    1. The word “incorrectly.”
    2. 1:45. The man gave away a total of 25 cents. He
    divided it between two
    people. Therefore, he gave a quarter to two.
    3. None, the boat rises with the tide. Googly 😉
    4. White. If all the walls face south, the house is at
    the North pole, and
    the bear, therefore, is a polar bear.
    5. Three. Well, it seems that it could almost be
    either, but if you follow
    the mathematical orders of operation, division is
    performed before
    addition.
    So… half of two is one. Then add two, and the answer
    is three.
    6. Sloppy is a (gold)fish. The wind blew the shutters
    in, which knocked his
    goldfish-bowl off the table, and it broke, killing
    him.
    7. None. No matter how big a hole is, it’s still a
    hole: the absence of
    dirt.
    8. Both questions, same answer: the ball in the bucket
    of 45 degree F water
    hits the bottom of the bucket last. Did you think that
    the water in the 30
    degree F bucket is frozen? Think again. The question
    said nothing about
    that bucket having anything in it. Therefore, there is
    no water (or ice) to
    slow
    the ball down…
    9. The time and month/date/year American style
    calendar are 12:34, 5/6/78.
    10. One. If he combines all of his haystacks, they all
    become one big
    stack.
    11. The temperature.

  • Does God Exist?

    The professor of a university challenged his students with this
    question. “Did God create everything that exists?” A student
    answered bravely, “Yes, he did”.

    The professor then asked, “If God created everything, then he
    created evil. Since evil exists (as noticed by our own actions), so
    God is evil. The student couldn’t respond to that statement causing
    the professor to conclude that he had “proved” that “belief in God”
    was a fairy tale, and therefore worthless.

    Another student raised his hand and asked the professor, “May I pose
    a question? ” “Of course” answered the professor.

    The young student stood up and asked : “Professor does Cold exists?”

    The professor answered, “What kind of question is that?…Of course
    the cold exists… haven’t you ever been cold?”

    The young student answered, “In fact sir, Cold does not exist.
    According to the laws of Physics, what we consider cold, in fact is
    the absence of heat. Anything is able to be studied as long as it
    transmits energy (heat). Absolute Zero is the total absence of heat,
    but cold does not exist. What we have done is create a term to
    describe how we feel if we don’t have body heat or we are not hot.”

    “And, does Dark exist?”, he continued. The professor answered “Of
    course”. This time the student responded, “Again you’re wrong,Sir.
    Darkness does not exist either. Darkness is in fact simply the
    absence of light. Light can be studied, darkness can not. Darkness
    cannot be broken down. A simple ray of light tears the darkness and
    illuminates the surface where the! light beam finishes. Dark is a
    term that we humans have created to describe what happens when
    there’s lack of light.”

    Finally, the student asked the professor, “Sir, does evil exist?”
    The professor replied, “Of course it exists, as I mentioned at the
    beginning, we see violations, crimes and violence anywhere in the
    world, and those things are evil.”

    The student responded, “Sir, Evil does not exist. Just as in the
    previous cases, Evil is a term which man has created to describe the
    result of the absence of God’s presence in the hearts of man.

    After this, the professor bowed down his head, and didn’t answer
    back.

    The young man’s name was ALBERT EINSTEIN.

  • Some points to ponder

    If we could shrink the earth’s population to a village of precisely 100 people, with all the existing human ratios remaining the same, it would look something like the following:
    There would be:
    57 Asians
    21 Europeans
    14 from the Western Hemisphere, both north and south
    8 Africans

    52 would be female
    48 would be male

    70 would be non-white
    30 would be white

    70 would be non-Christian
    30 would be Christian

    89 would be heterosexual
    11 would be homosexual

    6 people would possess 59% of the entire world’s wealth and
    all 6 would be from the United States.

    80 would live in substandard housing

    70 would be unable to read

    50 would suffer from malnutrition

    1 would be near death; 1 would be near birth

    1 (yes, only 1) would have a college education

    1 would own a computer

    When one considers our world from such a compressed perspective, the need for acceptance, understanding and education becomes glaringly apparent.

    The following is also something to ponder…

    If you woke up this morning with more health than illness…you are more blessed than the million who will not survive this week.

    If you have never experienced the danger of battle, the loneliness of imprisonment, the agony of torture, or the pangs of starvation…you are ahead of 500 million people in the world.

    If you can attend a church meeting without fear of harassment, arrest,torture, or death…you are more blessed than three billion people in the world.

    If you have food in the refrigerator, clothes on your back, a roof overhead and a place to sleep…you are richer than 75% of this world.

    If you have money in the bank, in your wallet, and spare change in a dish someplace … you are among the top 8% of the world’s wealthy.

    If your parents are still alive and still married… you are very rare,even in the United States and Canada.

    If you can read this message, you just received a double blessing in that someone was thinking of you, and furthermore, you are more blessed than over two billion people in the world that cannot read at all.

    Someone once said:
    What goes around comes around.
    Work like you don’t need the money.
    Love like you’ve never been hurt.
    Dance like nobody’s watching.
    Sing like nobody’s listening.
    Live like it’s Heaven on Earth.

  • Five Important Lessons

    Subject: 5 important lessons

    Five lessons to make you think about the way we treat people.

    1 – First Important Lesson – Cleaning Lady.
    During my second month of college, our professor gave us a pop quiz. I was
    a conscientious student and had breezed through the questions,
    until I read the last one: “What is the first name of the woman who cleans the school?

    Surely this was some kind of joke. I had seen the cleaning woman several times.
    She was tall, dark-haired and in her 50s, but how would I know her name?
    I handed in my paper, leaving the last question blank. Just before class ended,
    one student asked if the last question would count toward our quiz grade.
    “Absolutely,” said the professor. “In your careers, you will meet many people.
    All are significant. They deserve your attention and care, even if all you do is smile and say ‘hello’.

    I’ve never forgotten that lesson. I also learned her name was Dorothy.

    2. – Second Important Lesson – Pickup in the Rain

    One night, at 11.30 p.m., an older African American woman was standing on
    the side of an Alabama highway trying to endure a lashing rainstorm. Her car
    had broken down and she desperately needed a ride. Soaking wet, she decided
    to flag down the next car. A young white man stopped to help her, generally
    unheard of in those conflict-filled 1960s. The man took her to safety,
    helped her get assistance and put her into a taxicab. She seemed to be in a
    big hurry, but wrote down his address and thanked him.

    Seven days went by and a knock came on the man’s door. To his surprise, a
    giant console colour TV was delivered to his home. A special note was
    attached. It read: “Thank you so much for assisting me on the highway the other night.
    The rain drenched not only my clothes, but also my spirits. Then you came
    along. Because of you, I was able to make it to my dying husband’s
    bedside just before he passed away. God bless you for helping me and
    unselfishly serving others.”

    Sincerely, Mrs. Nat King Cole.

    3 – Third Important Lesson – Always remember those who serve.

    In the days when an ice cream sundae cost much less, a 10 -year-old
    boy entered a hotel coffee shop and sat at a table. A waitress put a glass
    of water in front of him. “How much is an ice cream sundae?” he asked.” Fifty cents,” replied the waitress.

    The little boy pulled his hand out of his pocket and studied the coins in
    it. “Well how much is a plain dish of ice cream?” , he inquired.

    By now more people were waiting for a table and the waitress was growing
    impatient. “Thirty-five cents,” she brusquely replied. The little boy again
    counted his coins. “I’ll have the plain ice cream,” he said. The waitress
    brought the ice cream, put the bill on the table and walked away. The boy
    finished the ice cream, paid the cashier and left. When the waitress came
    back, she began to cry as she wiped down the table.
    There, placed neatly beside the empty dish, were two nickels and five
    pennies. You see, he couldn’t have the sundae, because he had
    to have enough left to leave her a tip.

    4 – Fourth Important Lesson. – The obstacle in Our Path.

    In ancient times, a King had a boulder placed on a roadway. Then he hid
    himself and watched to see if anyone would remove the huge rock. Some of
    the king’s wealthiest merchants and courtiers came by and simply walked
    around it. Many loudly blamed the King for not keeping the roads clear,
    but none did anything about getting the stone out of the way.

    Then a peasant came along carrying a load of vegetables. Upon approaching
    the boulder, the peasant laid down his burden and tried to move
    the stone to the side of the road. After much pushing and straining,
    he finally succeeded. After the peasant picked up his load of vegetables,
    he noticed a purse lying in the road where the boulder had been. The purse
    contained many gold coins and a note from the King indicating that the gold
    was for the person who removed the boulder from the roadway. The peasant
    learned what many of us never understand!
    Every obstacle presents an opportunity to improve our condition.

    5 – Fifth Important Lesson – Giving When it Counts.

    Many years ago, when I worked as a volunteer at a hospital, I got to
    know a little girl named Liz who was suffering from a rare and serious
    disease.

    Her only chance of recovery appeared to be a blood transfusion from
    her 5-year old brother, who had miraculously survived
    the same disease and had developed the antibodies needed to combat the
    illness. The doctor explained the situation to her little brother, and
    asked the little boy if he would be willing to give his blood to his
    sister. I saw him hesitate for only a moment before taking a deep breath and
    saying,

    “Yes I’ll do it if it will save her.”

    As the transfusion progressed, he lay in bed next to his sister and
    smiled, as we all did, seeing the colour returning to her cheek. Then his
    face grew pale and his smile faded. He looked up at the doctor and
    asked with a trembling voice, “Will I start to die right away”.

    Being young the little boy had misunderstood the doctor; he thought he
    was going to have to give his sister all of his blood in order to save her.