Friday, December 19, 2008

Data Structures - Think well. Its easy

You are given an array of size 1001. The array contents are at random containing values from 1 to 1001. All element except one occurs only once in that array. Find the repeating element. Optimize for time and space complexity.

Write an algorithm for run-length encoding

How will you find the middle node of a linked list? Optimize for time and space.

How will you check whether a linked list has a loop?

Data Structures - Try Applying what you learnt

What are the applications of a stack?

Explain the tower of hanoi alogrithm for disk, n = 4

Write a snippet code for push, pop, peep and change.

You are given with some computer nodes and the distance between the nodes. Your work is to find out the minimum length of wire that must be used to connect one computer to another. Which algorithm will you use to solve this. What is the peculiarity of this algorithm?

How will you implement a stack other than arrays?

Find the length of a string in a single line.

Data Structure - Just Define

What is a Data Structure?

What is Algorithm?

What is linear linked list? why is it called so?

What type of tree is balanced but more efficient than AVL trees?

What is a B-Tree?

What is a B+ tree? Is B+ tree more effecient than a B-tree? If yes how?

What is a height balanced tree? What are the other names that you can use for height balanced tree?

Friday, December 12, 2008

MS questions

Microsoft Interview Questions

The following are actual questions from actual interviews conducted by Microsoft employees on the main campus. Microsoft Consultants are sometimes allowed to have a life, so questions asked of them during interviews don't really count and aren't listed.

The questions tend to follow some basic themes:


Riddles

  • Why is a manhole cover round?
  • How many cars are there in the USA? (A popular variant is "How many gas stations are there in the USA?")
  • How many manhole covers are there in the USA?
  • You've got someone working for you for seven days and a gold bar to pay them. The gold bar is segmented into seven connected pieces. You must give them a piece of gold at the end of every day. If you are only allowed to make two breaks in the gold bar, how do you pay your worker?
  • One train leaves Los Angeles at 15mph heading for New York. Another train leaves from New York at 20mph heading for Los Angeles on the same track. If a bird, flying at 25mph, leaves from Los Angeles at the same time as the train and flies back and forth between the two trains until they collide, how far will the bird have traveled?
  • Imagine a disk spinning like a record player turn table. Half of the disk is black and the other is white. Assume you have an unlimited number of color sensors. How many sensors would you have to place around the disk to determine the direction the disk is spinning? Where would they be placed?
  • Imagine an analog clock set to 12 o'clock. Note that the hour and minute hands overlap. How many times each day do both the hour and minute hands overlap? How would you determine the exact times of the day that this occurs?
  • You have two jars, 50 red marbles and 50 blue marbles. A jar will be picked at random, and then a marble will be picked from the jar. Placing all of the marbles in the jars, how can you maximize the chances of a red marble being picked? What are the exact odds of getting a red marble using your scheme?
  • Pairs of primes separated by a single number are called prime pairs. Examples are 17 and 19. Prove that the number between a prime pair is always divisible by 6 (assuming both numbers in the pair are greater than 6). Now prove that there are no 'prime triples.'
  • There is a room with a door (closed) and three light bulbs. Outside the room there are three switches, connected to the bulbs. You may manipulate the switches as you wish, but once you open the door you can't change them. Identify each switch with its bulb.
  • Suppose you had 8 billiard balls, and one of them was slightly heavier, but the only way to tell was by putting it on a scale against another. What's the fewest number of times you'd have to use the scale to find the heavier ball?
  • Imagine you are standing in front of a mirror, facing it. Raise your left hand. Raise your right hand. Look at your reflection. When you raise your left hand your reflection raises what appears to be his right hand. But when you tilt your head up, your reflection does too, and does not appear to tilt his/her head down. Why is it that the mirror appears to reverse left and right, but not up and down?
  • You have 4 jars of pills. Each pill is a certain weight, except for contaminated pills contained in one jar, where each pill is weight + 1. How could you tell which jar had the contaminated pills in just one measurement?
  • The SF Chronicle has a word game where all the letters are scrambled up and you have to figure out what the word is. Imagine that a scrambled word is 5 characters long:
    1. How many possible solutions are there?
    2. What if we know which 5 letters are being used?
    3. Develop an algorithm to solve the word.
  • There are 4 women who want to cross a bridge. They all begin on the same side. You have 17 minutes to get all of them across to the other side. It is night. There is one flashlight. A maximum of two people can cross at one time. Any party who crosses, either 1 or 2 people, must have the flashlight with them. The flashlight must be walked back and forth, it cannot be thrown, etc. Each woman walks at a different speed. A pair must walk together at the rate of the slower woman's pace.

    Woman 1: 1 minute to cross
    Woman 2: 2 minutes to cross
    Woman 3: 5 minutes to cross
    Woman 4: 10 minutes to cross

    For example if Woman 1 and Woman 4 walk across first, 10 minutes have elapsed when they get to the other side of the bridge. If Woman 4 then returns with the flashlight, a total of 20 minutes have passed and you have failed the mission. What is the order required to get all women across in 17 minutes? Now, what's the other way?

  • If you had an infinite supply of water and a 5 quart and 3 quart pail, how would you measure exactly 4 quarts?
  • You have a bucket of jelly beans. Some are red, some are blue, and some green. With your eyes closed, pick out 2 of a like color. How many do you have to grab to be sure you have 2 of the same?
  • If you have two buckets, one with red paint and the other with blue paint, and you take one cup from the blue bucket and poor it into the red bucket. Then you take one cup from the red bucket and poor it into the blue bucket. Which bucket has the highest ratio between red and blue? Prove it mathematically.

Algorithms

  • What's the difference between a linked list and an array?
  • Implement a linked list. Why did you pick the method you did?
  • Implement an algorithm to sort a linked list. Why did you pick the method you did? Now do it in O(n) time.
  • Describe advantages and disadvantages of the various stock sorting algorithms.
  • Implement an algorithm to reverse a linked list. Now do it without recursion.
  • Implement an algorithm to insert a node into a circular linked list without traversing it.
  • Implement an algorithm to sort an array. Why did you pick the method you did?
  • Implement an algorithm to do wild card string matching.
  • Implement strstr() (or some other string library function).
  • Reverse a string. Optimize for speed. Optimize for space.
  • Reverse the words in a sentence, i.e. "My name is Chris" becomes "Chris is name My." Optimize for speed. Optimize for space.
  • Find a substring. Optimize for speed. Optimize for space.
  • Compare two strings using O(n) time with constant space.
  • Suppose you have an array of 1001 integers. The integers are in random order, but you know each of the integers is between 1 and 1000 (inclusive). In addition, each number appears only once in the array, except for one number, which occurs twice. Assume that you can access each element of the array only once. Describe an algorithm to find the repeated number. If you used auxiliary storage in your algorithm, can you find an algorithm that does not require it?
  • Count the number of set bits in a number. Now optimize for speed. Now optimize for size.
  • Multiple by 8 without using multiplication or addition. Now do the same with 7.
  • Add numbers in base n (not any of the popular ones like 10, 16, 8 or 2 -- I hear that Charles Simonyi, the inventor of Hungarian Notation, favors -2 when asking this question).
  • Write routines to read and write a bounded buffer.
  • Write routines to manage a heap using an existing array.
  • Implement an algorithm to take an array and return one with only unique elements in it.
  • Implement an algorithm that takes two strings as input, and returns the intersection of the two, with each letter represented at most once. Now speed it up. Now test it.
  • Implement an algorithm to print out all files below a given root node.
  • Given that you are receiving samples from an instrument at a constant rate, and you have constant storage space, how would you design a storage algorithm that would allow me to get a representative readout of data, no matter when I looked at it? In other words, representative of the behavior of the system to date.
  • How would you find a cycle in a linked list?
  • Give me an algorithm to shuffle a deck of cards, given that the cards are stored in an array of ints.
  • The following asm block performs a common math function, what is it?
    cwd xor ax, dx
    sub ax, dx
  • Imagine this scenario:
    I/O completion ports are communictaions ports which take handles to files, sockets, or any other I/O. When a Read or Write is submitted to them, they cache the data (if necessary), and attempt to take the request to completion. Upon error or completion, they call a user-supplied function to let the users application know that that particular request has completed. They work asynchronously, and can process an unlimited number of simultaneous requests.
    Design the implementation and thread models for I/O completion ports. Remember to take into account multi-processor machines.
  • Write a function that takes in a string parameter and checks to see whether or not it is an integer, and if it is then return the integer value.
  • Write a function to print all of the permutations of a string.
  • Implement malloc.
  • Write a function to print the Fibonacci numbers.
  • Write a function to copy two strings, A and B. The last few bytes of string A overlap the first few bytes of string B.
  • How would you write qsort?
  • How would you print out the data in a binary tree, level by level, starting at the top?

Applications

  • How can computer technology be integrated in an elevator system for a hundred story office building? How do you optimize for availability? How would variation of traffic over a typical work week or floor or time of day affect this?
  • How would you implement copy-protection on a control which can be embedded in a document and duplicated readily via the Internet?
  • Define a user interface for indenting selected text in a Word document. Consider selections ranging from a single sentence up through selections of several pages. Consider selections not currently visible or only partially visible. What are the states of the new UI controls? How will the user know what the controls are for and when to use them?
  • How would you redesign an ATM?
  • Suppose we wanted to run a microwave oven from the computer. What kind of software would you write to do this?
  • What is the difference between an Ethernet Address and an IP address?
  • How would you design a coffee-machine for an automobile.
  • If you could add any feature to Microsoft Word, what would it be?
  • How would you go about building a keyboard for 1-handed users?
  • How would you build an alarm clock for deaf people?

Thinkers

  • How are M&Ms made?
  • If you had a clock with lots of moving mechanical parts, you took it apart piece by piece without keeping track of the method of how it was disassembled, then you put it back together and discovered that 3 important parts were not included; how would you go about reassembling the clock?
  • If you had to learn a new computer language, how would you go about doing it?
  • You have been assigned to design Bill Gates bathroom. Naturally, cost is not a consideration. You may not speak to Bill.
  • What was the hardest question asked of you so far today?
  • If MS told you we were willing to invest $5 million in a start up of your choice, what business would you start? Why?
  • If you could gather all of the computer manufacturers in the world together into one room and then tell them one thing that they would be compelled to do, what would it be?
  • Explain a scenario for testing a salt shaker.
  • If you are going to receive an award in 5 years, what is it for and who is the audience?
  • How would you explain how to use Microsoft Excel to your grandma?
  • Why is it that when you turn on the hot water in any hotel, for example, the hot water comes pouring out almost instantaneously?
  • Why do you want to work at Microsoft?
  • Suppose you go home, enter your house/apartment, hit the light switch, and nothing happens - no light floods the room. What exactly, in order, are the steps you would take in determining what the problem was?
  • Interviewer hands you a black pen and says nothing but "This pen is red."

Monday, December 1, 2008

Appearances r deceptive


A medieval king (shown left) needed to work out how he could recruit fighting men for the battle ahead. However, there were so many distractions around the castle, his thinking became confused. So in order to change his daze into knights, he asked for a secluded walk to be made so he could ponder in peace. The head gardener was given the job of planting lines of high bushes. First, he planted a line running 100 paces east. Then from the end of that line he planted a line 100 paces north, then 100 west, 98 south, 98 east, 96 north, 96 west, and so on. This made a square spiral path 2 paces wide. If the king intended to walk down the middle of the path, how long was the path? ....

After all it is maths...


At the livestock market, the sheep were secured in 36 pens arranged in a 6x6 grid, the number in each pen shown left. "I want to make a tidy sum out of it," said the farmer. So, in line with the farmer's wishes, the buyer bought all of the sheep in 12 of the pens. Delete 12 of the 36 numbers to leave four numbers in each row and column, so that each of the six horizontal lines and each of the six vertical lines totals 20.

Illusion


Alf and Bert were sitting in the pub pondering over a ring-shaped cardboard beermat (shown left). Bert said: "How can you move just half of the letters to form the words HAIL CLIP reading clockwise?" Alf produced a pair of scissors and with seven radial cuts and a new positioning of the letters completed the task. "Very nice," said Bert, "but I could have done it with only one cut." Two problems : (a) What is Alf's method; (b) What cut does Bert make? ...

simple one

The fair had arrived in town. "A prize for guessing the number of balls under the mugs," shouted one stall owner, as he placed four upturned mugs on the counter in front of him. Each concealed the same number of balls and on each mug was a statement about the number of balls underneath : One or four; Two or four; Two or three; One or two. Only one of the statements was correct. How many balls were under a mug and which statement is true?

Check it out

http://techfest.org/online/puzzles/#
http://www.moneyweb.co.za/mw/view/mw/en/page215466?oid=242200&sn=Detail

Saturday, November 22, 2008

Odyssey Project Contest

1) Search Utility
Design a search utility with reasonable search time. Similar to Ava Find.

2) Su do ku Solver
Design a Sudoku solver with an attractive user interface which lets a user to solve and also provides solution for given grid.

3) Graphic Utility
Design utility software that assists in image processing.

4) Web site Designing
Design a job search web site with attractive user interfaces and rich functionality.

5) Audio Player With Equalizer
Design an audio player with equalizer.


* The search utility is similar to Ava find. Use multi threading to implement this. The datastructure that you use is of prime importance. Using Trie or other trees may speed up your algorithm. Using more than one data structure will also be effecient.

* Sudoku solver must also use multithreading. One thread must find the solution while the user is entering input. Complexity of the order of n2 is not acceptable. Use least complex algorithm.

* The Graphic utility must be done with Windows API and MFC. It should have its own extension and file header. The user must be able to open, view, load and save the files.

*
The main concern for the web design is the interface. The user must have a seperate account and when there is a need for a particular job, candidates meeting the requirement must be intimated by mail.

*
Audio Player can easily be implemented in java. Split the channels according to frequency to produce the output according to the user setting in the equalizer.

Wednesday, October 8, 2008

Series bonanza

1.18,46,94,63,52, ….

2.613452,25431,1342,231....

3.11,2,4,16,37,58...

4.0,9,26,65...

Disappointment

Vengeance went to chill out at the local club last night. However, due to an invitation only event the entry was restricted. Only people who spoke the correct password to the doorman were allowed to enter.

Vengeance was not aware of the password, so he waited by the door and listened. A guest knocked on the door and the doorman said, "Twelve."
The guest replied, "Six " and was let in.

A second guest came to the door and the doorman said, "Six."
The guest replied, "Three" and was let in.

At this moment
Vengeance thought that he had cracked the code and walked up to the door. The doorman said ,"Ten" to which Vengeance replied, "Five."

Unfortunately for
Vengeance, he was not let in.

What should have he said to gain entry to the club?

Cricket crazy

Honesty and Perseverance were watching a game of cricket when an interesting scenario surfaced. The two batsmen X and Y were playing on 98 runs and 94 runs respectively. Both wanted to score a century but their team required only 3 runs to win the match with only 2 balls remaining. It is given that X was on strike and both eventually made a century to win the match. There were no extra deliveries (no-balls/wide) bowled.

How is this possible?

Missing Jacket

Roger and Rafael visited a small town in France. While coming back , Roger forgot his Jacket in a bus. When he reported this to the bus company, the company asked him the bus number , which he vaguely remembered but he noted a peculiar property of the bus number. The number plate showed that the bus number was a perfect square and also if the plate was turned upside down, the number would still be perfect square. The bus company informed him they had only 500 buses with numbers from 1 to 500 . How was Roger able to deduce the bus number and what was the bus number ?

Free hit

In 1990, a person is 15 years old. In 1995 that same person is 10 years old. How is this possible?

IIT Puzzles

1. Suppose a clock's seconds hand is exactly on a second’s mark (one of
the sixty) and exactly 22 second marks ahead of the hour hand. What is
the time?

2. Nowadays as the security threat is rising, number locks are becoming
common.
Say you have a number lock having number keys from 1 to 5. You are
allowed to press either single keys or a pair of number keys simultaneously.
Also you cannot press 3 keys simultaneously or repeat a key which was
pressed previously. The order in which the keys were pressed matters but
when a pair is pressed simultaneously, there is no order between them i.e.
[(12)] is the same as [(21)].
Let’s call a key combination satisfying all these conditions as legal
combinations.
Find the number of such legal combinations.

3. You are given some matches, a thread and a pair of scissors. The thread
burns irregularly and takes 1 hour to burn from one end to the other. It has
a symmetry property that the burn rate at a distance x from the left end is
same as the burn rate at a distance x from the right end. What is the
minimum time interval you can measure accurately using the above?
Explain the method.

4. There are 26 stones having weights between 1kg and 26kg, not
necessarily distinct. All the weights are whole nos. All you have is a pan
balance. What is the minimum no. of known weights (whole numbered)
required to find the weight of each of the stones and what are they?
*Conventional methods might not always be the best ones

5.If 1 ----> 3
2 ----> 3
3 ----> 5
4 ---->4
5 ----> 4
6 ----> 3
7 ----> 5
8 ----> 5
9 ----> 4
10 ----> A . Find A.
Divide a regular hexagon into B (= A^2) pieces of two types (By types, we
mean two sets of geometric figures. Eg, a set of x congruent triangles and
a set of y congruent rectangles, where B=x+y) so that they can be
rearranged to form a single equilateral triangle.
Find x, y and the shape of the geometric figures.
(Describe in words, the division of the hexagon and formation of the
equilateral triangle)

6.You and 2 other people have numbers written on your foreheads. You are
all told that the numbers on your foreheads are prime and that they form
a triangle with a prime perimeter. You see 5 and 7 on the other 2 people.
All three of you claim you do not know the number on your forehead,
starting from you and now again it is your turn. Can you guess the number
on your forehead? Justify your answer.

7.A deck of cards has: 9 aces of spades, 8 deuces of spades, 7 threes… 2
eights and 1 nine of spade: 45 cards in total. The deck is shuffled and a
card is drawn. You should guess it by asking yes-no questions.
How can you minimize the number of questions that you will probably
have to ask? How will your answer differ
- If the deck is replaced by numbers one to one million?
- If the person who answers is permitted to lie twice?

8.Generally a ray of light can reflect many times between 2 ordinary line
mirrors. Now we introduce the condition that on each line mirror there is
only one point of reflection i.e. any ray can get reflected only at this
particular point on that mirror. Now let us call such mirrors as point mirrors.
But the laws of reflection are still dependent on the orientation of the line.
We find a maximum of 3 reflections for 2 mirrors. What is the maximum no.
of reflections for (a) 4 mirrors (b) 5 mirrors.

9.The Good, The Bad and The Ugly get into a pistol duel under unusual terms. They
draw lots and determine the order in which they start firing (who first, who second
and who third). They also decide to use the same type of pistol and bullets. Then,
they take up their positions at the corners of an equilateral triangle. They come to an
agreement that each of them will fire single shots, in turn, and continue in the same
cyclic order until two of them are dead. At his turn, the one who is firing may aim
wherever he pleases. It is also well known that The Bad always hits his target, The
Ugly hits his target three out of four turns and The Good manages only one out of
two. Assume that all of them adopt the best strategy in the duel and no one is killed
by an arbitrary shot not intended for him.
Who has the best chance to survive?
What are the exact survival probabilities of the three men?
How will your answer differ if the triangle is not equilateral and, in turns, they start
shooting bullets at regular intervals of time? Explain.

10.Gandalf and the Fellowship, finding their way through the Mines of Moria
reach a spot where they find too many paths branching out. Some
branches lead out of the Mines safely while others do not. No one knows
beforehand which branches are safe and which are not. They are
suddenly confronted by a Balrog. Panic settles in and Gandalf and the
Fellowship are separated. Both of them randomly select a distinct branch
from the set of pathways and pursue it. It is an even-money bet that both
Gandalf and the Fellowship have chosen safe pathways.
What may be the possible number of total safe pathways?

11.T-Bag is left stranded in a desolate desert area in Panama with just a
scooter and a broken hand. He discovers that there is an unlimited supply
of petrol at that particular place. He has to traverse a distance of 1000
miles and knows that there is no other petrol source on the way. His
scooter can carry petrol to go 500 miles (say L liters) and he can build his
own refueling stations at any spot on the way.
What is the minimum amount of petrol in liters he will require in order to
cross the desert? Is there a limit to the width of the desert he can cross?
How will your answer change if he has to return to the original spot?
Assume that there are no evaporation losses.

12.A hostess at her 20th wedding anniversary tells everyone "I normally ask
guests to guess the age of my three children given the sum and product
of their ages. Since Twister got it wrong tonight and Bulb got it wrong 2
years ago, I'll let you off the hook...."
You are a puzzle god and you immediately stop her saying "Their ages
are...."
Complete your statement.
But if you are not a puzzle god, you have a clue: One of their ages is 6.

13.Given that x is not an integer, find x to complete the following sequence:
35, 45, 60, x, 120, 180, 280, 450, 744

14.In a school of witchcraft and wizardry on a different planet, years which
can be written in the form y = (p^2)*q are identified as special years,
where p and q are primes. The first few of these are 12, 18 and 20.
A student is called an amateur until he reaches the first special year which
is followed by another special year (consecutive). Then he is called a
master until reaching a special year which is followed by 2 consecutive
special years when he is called a wizard and so on...He finally dies when
he cannot get to the next stage i.e. when there
exists no such special year which is followed by n-1 consecutive special
years.
When will a student in this school become a master?
When will he become a wizard?
When will he die? I.e. what is the value of n?
*Count all the years from the time of joining.

Wednesday, September 3, 2008

Arrange

Can you arrange these letters into one long word:
d o o r n o n e g w l

Last man standing

There are 100 persons whose numbers are from 1 to 100 in a circular structure.
Initially one sword has given to first person.The first person killed the second person and handed the sword to third one.Third one killed fourth person and handed it to fifth.
This is continued until all the persons died except the final person.Who is that final person.

Vacation

A family X went for a vacation. Unfortunately it rained for 13 days when they were there. But whenever it rained in the mornings, they had clear afternoons and vice versa. In all they enjoyed 11 mornings and 12 afternoons. How many days did they stay there totally?

Saving plan

A banana plantation is located next to a desert. The plantation owner has 3000 bananas that he wants to transport to the market by camel, across a 1000 kilometre stretch of desert. The owner has only one camel, which carries a maximum of 1000 bananas at any moment in time, and eats one banana every kilometre it travels. What is the largest number of bananas that can be delivered at the market?

Divide it if u can...

The legendary king Midas possessed a huge amount of gold. He hid this treasure carefully: in a building consisting of a number of rooms. In each room there were a number of boxes; this number was equal to the number of rooms in the building. Each box contained a number of golden coins that equaled the number of boxes per room. When the king died, one box was given to the royal barber. The remainder of the coins had to be divided fairly between his six sons. Is a fair division possible in all situations?

Is it true... no it is not so...

Below are a number of statements: 1. Precisely one of these statements is untrue. 2. Precisely two of these statements are untrue. 3. Precisely three of these statements are untrue. 4. Precisely four of these statements are untrue. 5. Precisely five of these statements are untrue. 6. Precisely six of these statements are untrue. 7. Precisely seven of these statements are untrue. 8. Precisely eight of these statements are untrue. 9. Precisely nine of these statements are untrue. 10. Precisely ten of these statements are untrue. Which of these statements is true?

It's unusual

This is a most unusual paragraph. How quickly can you find out what is so unusual about it? It looks so ordinary that you would think that nothing is wrong with it at all, and, in fact, nothing is. But it is unusual. Why? If you study it and think about it, you may find out, but I am not going to assist you in any way. You must do it without any hints or coaching. No doubt, if you work at it for a bit, it will dawn on you. Who knows? Go to work and try your skill. Good luck! What is unusual about the above paragraph?

Sunday, August 31, 2008

Share or get killed

5 sea pirates have 100 gold coins and want to share it. They propose a plan. The senior most one has to propose an idea, if at least 50 % agree, the coins r shared accordingly. else the senior is killed and the next senior most is asked to present a plan and so on .note, all the guys r very clever and very greedy and dont want to lose the coins, and dont want to die. Form a way to share the money.

R u a Genius?

2 maths geniuses meet after 20 yrs.one says i am married. and have 3 daughters. the product of their ages is 72. the sum is the same as the house no. other says, but I cant find it out. The other says. . simple. ok, my eldest daughter has just started the piano classes.Find their ages.

Zero in

In a train Art is found dead. hours later 4 people are queried,
-Blonde says i am innocent, i didnt speak with Art
-White says i am innocent, Blonde spoke with Art
-Old says i am innocent, the brunette killed Art
-Brunette says i am innocent, one of the men killed Art
-The inspector says simple, 4 true statements, 4 false statements.
-I know the killer, very simple!!!
-Find out the killer. (only one is involved.)

Palindrome

If the date is written as MMDDYYYY, and then 10022001, ie) oct 2 2001 is a palindrome. which is the immediate palindrome before that date.?

Thursday, August 28, 2008

what is the next term?

For the following, find the next term in the series 0, 5, 8, 17 ?

Tuesday, August 19, 2008

Nexus

* * *
* * *
* * *
connect these points using only 4 straight lines without taking out the hand.. dont trace the same lines twice or more....

6 n 12

How can we draw 6 equal sized square using 12 equal lines?

Puzzle

How can we draw 6 equal sized square using 12 equal lines?

Tuesday, August 12, 2008

As simple as u wish

If u start writing numbers from 1000, What would be the 100000th digit written by u?

Saturday, August 9, 2008

Beauty Contest

Kamal Babu came home just after judging a beauty contest where there were four
semi-finalists: Ms.Uttar Pradesh, Ms.Maharashtra, Ms.Andhra Pradesh and Ms.West
Bengal. His wife was very keen on knowing who the winner was and kamal Babu replied immediately that it was the one wearing the yellow saree. When his wife asked for more details, he gave the following information:

The four girls were wearing saris of different colors (yellow, red, green, white) and the runner-up was wearing green. The four girls were sitting in a row, and Ms.West Bengal was not sitting at either end. There was only one runner-up and she was sitting next to s.Maharashtra. The girls wearing yellow and white saris occupied the seats at either end. s.West Bengal was neither the winner nor the runner-up. Ms.Maharashtra was wearing white. The winner and the runner-up were not sitting next to each other.

The girl wearing the green sari was not Ms.Andhra Pradesh.

Answer the following questions based on the above information.

1. Who was wearing the red sari?
a) Ms.AP b) Ms.WB c) Ms.UP d) cannot be determined

2 Between which two was Ms.West Bengal sitting?
a) Ms.APand Ms.UP b) Ms.Andhra and Ms.Maharashtra c) Ms.Uttar and Ms. Maharashtra d) Cannot be determined.

3. What was the color of the sari that Ms.Uttar Pradesh was wearing?
a) White b) Green c) Red d) Yellow

4. What was the color if the sari that Ms.Andhra was wearing?
a) White b) Yellow c) Red d) Indeterminate

Milk and Poison

You have 15 bottles of milk and 1 bottle of poison. 4 persons can be tested on, just by giving one sample to each. You have to find out which bottles contains poison. Either all or no one or any 3 or any 2 or any 1 can die in any combination.

Wednesday, August 6, 2008

Out of ur thoughts!!!

Lets start with a simple one...
A man goes into a bar and asks for water. The waiter points the gun at him. The man says "Thank You" and returns. For wat reason did the man ask water...

c simple

Explain how to implement two stacks in one array in such a way that neither stack overflows unless the total number of elements in both the stacks together is n. The push operation must run in O(1) time...

Monday, August 4, 2008

Bouncer

Mr.Ocean recently took up a job of a booking clerk at the local railway station. The station falls on a track which has 25 stations in all. At each of the 25 stations a passenger can get tickets for any of the other 24 stations.How many different types of tickets should Ocean keep to serve any possible booking request?

Free Hit!!!

x
85 90
29 67 0
83 33 69 2
1 81 91 57 36
60 55 61 29 35 6
29 42 45 23 13 5 16
23 13 44 7 39 69 47 98
61 41 91 82 1 37 27 71 36
6 4 6 9 0 8 9 5 9 6
find x???

Wrong 'un

What is the remainder when 9^1 + 9^2 + 9^3 + .... + 9^8 is divided by 6?

Monday, July 28, 2008

cpuzzle3

How will u find whether a linked list has a loop or not?
NOTE:[No extra memory is to be used. The loop may intersect even at center]

Sunday, July 27, 2008

C challenge 2

Given n nodes. Find the number of different structural binary trees that can be formed using the nodes.  Reply by posting a gcc or g++ compatible codes. Also explain ur codes

C challenge

You are given any character string. Find the number of sets of vowels that come in the order of aeiou in the given string. For eg., let the given string be DIPLOMATIC. The answer returned must be "The number of sets is 2" and "The sets are "IO and AI". Vowels that form a singleton set must be neglected. Try to post the program executable in gcc or g++ or in java.

Monday, July 21, 2008

Puzzle1

Smugs has found a real tough one for Bets. There is a sequence which goes:

9 2 1 8 3 3 6 4 7 2

He wants Bets to tell what the next term in this sequence is. Can you help Bets?

Welcome CSITAns

Hi everybody,

     We are creating this blog to aid our placement preparation and to improve our knowledge. Do contribute your best to keep this blog lively and active.