Asadullah Ansari

Build-Up Your Problem Solving Skill : Specially Using By C/C++/Data Structure Puzzles/New Technique Algorithm Design/ Understanding New Technology

Archive for August, 2008

Freeze your mind!!!!

Posted by asadullahansari on August 22, 2008

A bank has a collection of n bank cards that they�€™ve confiscated, suspecting them of being used in a fraud. Each bank card corresponds to a unique account in the bank. Each account can have many cards corresponding to it, and we�€™ll say that two bank cards are equivalent if they correspond to the same account. The only way to say 2 cards are equivalent is by using a high-tech �€œequivalence-tester�€� that takes in 2 cards, and after performing some computations, determines whether they are equivalent.

Their question is the following: among the collection of n cards, is there a set of more than n/2 of them that are all equivalent to one another? Assume that the only feasible operations you can do with the cards are to pick two of them and plug them in to the equivalence tester.
Solve it in O(n) complexity.

Posted in Queries & Answers | Tagged: , | Leave a Comment »

write a program for bit count in a 32-bit integer number?

Posted by asadullahansari on August 21, 2008

Program should be efficient. Dont count every bit by loop…Cheers!!!!

Posted in C/C++ Queries & Ans | 1 Comment »

Appreciation plays Important role to develope problem solving skill !!! Believe it!!!

Posted by asadullahansari on August 21, 2008

You read this Example!!!

Appreciation Advantage

Gather Information from facts More and More or as much as possible

Lot of people does not understand appreciation and someone understand but not able to implement it. Appreciation is not a tough but it’s very simple but One thing it’s Very powerful technique to gather More and More Information from people, from employee, etc. By using this technique in both ways improvement example : In an organization, If Manager use this technique then it’s benefit for organization , as for skill developement of employee, Manager aspects satishfaction etc. So cheers to use this skill.

I will take a example of Military Sytem who are making plan.
Example: Military Planners

Fact: It rained heavily last night

So What? //

– The ground will be wet

So What?

– It will turn into mud quickly

So What?

– If many troops and vehicles pass over the same ground, movement will be progressively slower and more difficult as the ground gets muddier and more difficult.

So What?

– Where possible, stick to paved roads. Otherwise expect movement to be much slower than normal.

While it would be possible to reach this conclusion without the use of a formal technique, Appreciation provides a framework within which you can extract information quickly, effectively and reliably.

Key points:

>> Asking ‘so what?’ repeatedly helps you to extract all important information implied by a fact.

>> Just listen all possible solutions it may be at all not useful but still appreciate his things and keep asking to gather more and
more information

>> Appreciation can be used to recuitement of good employees.

>> Appreciation can make employee- manager relationship good and by this method you can get more excellent solutions than
not using appreciation.


Posted in Tips to Improve Skills | Leave a Comment »

Give the optimized algorithm for this?

Posted by asadullahansari on August 20, 2008

Suppose a number is given. You have to write an algorithm to find sum of two elements of a given array which should equal to a given number.

arr[]={ 2,5 ,7 ,9 ,4 ,6 ,8 }
a number give nSum= 17

then You have to find elements 9 and 8.

Posted in Algo design: Queries | Leave a Comment »

solve this puzzle?

Posted by asadullahansari on August 20, 2008

Two boys walking in the woods decide to take a shortcut thru a railroad tunel. When they had walked 2/3 of the way, their worst fears were realized. A train was coming in the opposite direction, nearing the tunnel entrance. They boys panicked and each ran for a different end of the tunnel. Both boys ran at the same speed, 10 miles per hour Each boy escaped from the tunnel just at the instant the train would have squashed him. Assuming the train’s speed was constant, and both boys were capable of instantaneous reaction and acceleration, how fast was the train going?

Posted in Queries & Answers | Tagged: | 4 Comments »

Can You tell me All cases where Initialization list is mandatory in C++?

Posted by asadullahansari on August 20, 2008

Can you please tell me all possible cases where Constructor Initialization list is mandatory?

Posted in C/C++ Queries & Ans | 2 Comments »