analytical Skill for Java Development  
Author Message
moejo





PostPosted: 2006-2-10 0:24:00 Top

java-programmer, analytical Skill for Java Development > As an experiment, give an "experienced" developer a problem and watch
> their
> analytical and problem solving skills seriously fail him/her. This of
> course, is the general case - there may be some corner cases where this
> will
> not occur.

So how can one learn better problem solving skills? In addition to
problem solving, where can one find better algorithms to use?

 
moejo





PostPosted: 2006-2-10 0:24:00 Top

java-programmer >> analytical Skill for Java Development > As an experiment, give an "experienced" developer a problem and watch
> their
> analytical and problem solving skills seriously fail him/her. This of
> course, is the general case - there may be some corner cases where this
> will
> not occur.

So how can one learn better problem solving skills? In addition to
problem solving, where can one find better algorithms to use?

 
Scott.R.Lemke@gmail.com





PostPosted: 2006-2-10 0:38:00 Top

java-programmer >> analytical Skill for Java Development Ignore what I wrote before. Oliver found the real minimum worst case of
14, and it appears that the general solution would be x such that
Summation(x) >= upper bound, And that it is the first Summation to do
so.

IE, for 100 Sum(13) = 91, so it wont work, but Sum(14) = 104. So the
best worst case is 14 steps.

 
 
Eric Sosman





PostPosted: 2006-2-10 0:50:00 Top

java-programmer >> analytical Skill for Java Development

moejo wrote On 02/09/06 11:23,:
>>As an experiment, give an "experienced" developer a problem and watch
>>their
>>analytical and problem solving skills seriously fail him/her. This of
>>course, is the general case - there may be some corner cases where this
>>will
>>not occur.
>
>
> So how can one learn better problem solving skills? In addition to
> problem solving, where can one find better algorithms to use?

The problem of how to solve problems is itself
solved, by Feynman's Algorithm:

Step 1: Take a piece of paper, and write down
everything you know about the problem.

Step 2: Think really hard.

Step 3: Write down the answer.

--
email***@***.com

 
 
Dimitri Maziuk





PostPosted: 2006-2-10 1:18:00 Top

java-programmer >> analytical Skill for Java Development Roedy Green sez:
> On Wed, 8 Feb 2006 00:42:07 -0800, "Adam Maass"
><email***@***.com> wrote, quoted or indirectly quoted
> someone who said :
>
>>2) You have many piles of rocks. The rocks in each pile are identical. There
>>are an infinite number of rocks in each pile. You know that the rocks in one
>>of the piles are slightly heavier than the rocks in all the other piles.
>>(Say 1.1 kg instead of 1 kg.) You have a scale that you may use exactly
>>once. Describe an algorithm to determine which pile contains the heavier
>>rocks.
>
> Depends what you mean by a scale.

Not really: a pile of infinite number of rocks (provided it does
not collapse on itself into a black hole as suggested upthread)
will contain all the matter in the universe and occupy all the
space.

There is neither room nor matter for a scale of any kind. Nor
for the experimenter, nor other piles.

The solution is to not try to weigh the rocks, but instead to
realise The Truth(tm).

Dima
--
We're sysadmins. Sanity happens to other people. -- Chris King
 
 
Oliver Wong





PostPosted: 2006-2-10 1:20:00 Top

java-programmer >> analytical Skill for Java Development
"Eric Sosman" <email***@***.com> wrote in message
news:dsfrr0$iij$email***@***.com...
>
>
> moejo wrote On 02/09/06 11:23,:
>>>As an experiment, give an "experienced" developer a problem and watch
>>>their
>>>analytical and problem solving skills seriously fail him/her. This of
>>>course, is the general case - there may be some corner cases where this
>>>will
>>>not occur.
>>
>>
>> So how can one learn better problem solving skills? In addition to
>> problem solving, where can one find better algorithms to use?
>
> The problem of how to solve problems is itself
> solved, by Feynman's Algorithm:
>
> Step 1: Take a piece of paper, and write down
> everything you know about the problem.
>
> Step 2: Think really hard.
>
> Step 3: Write down the answer.

I seem to always get a Interrupted, TimeOut, NotImplemented, or
OutOfMemory exception/errors somewhere between step 2 and 3 when following
this algorithm.

- Oliver


 
 
Oliver Wong





PostPosted: 2006-2-10 1:58:00 Top

java-programmer >> analytical Skill for Java Development
"Dimitri Maziuk" <email***@***.com> wrote in message
news:email***@***.com...
> Roedy Green sez:
>> On Wed, 8 Feb 2006 00:42:07 -0800, "Adam Maass"
>><email***@***.com> wrote, quoted or indirectly quoted
>> someone who said :
>>
>>>2) You have many piles of rocks. The rocks in each pile are identical.
>>>There
>>>are an infinite number of rocks in each pile. You know that the rocks in
>>>one
>>>of the piles are slightly heavier than the rocks in all the other piles.
>>>(Say 1.1 kg instead of 1 kg.) You have a scale that you may use exactly
>>>once. Describe an algorithm to determine which pile contains the heavier
>>>rocks.
>>
>> Depends what you mean by a scale.
>
> Not really: a pile of infinite number of rocks (provided it does
> not collapse on itself into a black hole as suggested upthread)
> will contain all the matter in the universe and occupy all the
> space.

If there's an infinite number of rocks, this implies that there's an
infinite number of matter in the universe, and thus that the universe itself
is infinite.

In an infinite universe, there may exist subsets of the universe which
are themselves infinite. For example, maybe the universe is exactly composed
the union of {an infinite number of rocks} and {an infinite number of
scales}, in which case the rocks only make up "half" of the universe, but
there's still an infinite amount of them.

- Oliver


 
 
Richard Wheeldon





PostPosted: 2006-2-10 4:17:00 Top

java-programmer >> analytical Skill for Java Development Thomas Hawtin wrote:
> Nobody wants general problem-solution-capabilities. A sane employer will
> want someone capable in a particular field. Particular APIs aren't of
> much concern, nor is the ability to play silly games.

As much as anything it's a test of intelligence. The problem is
that a lot of these tests/games are just simple variations on others.
In that situation, it just becomes yet another memory test.

>>> I would have through the probability of a ball (pair) breaking when
>>> dropped from the first given it does not drop from the ground floor
>>> is much greater than it breaking from the 100th if it did not break
>>> from the 99th. Perhaps the vast majority of balls don't break when
>>> dropped from the 100th, so the first ball should be dropped from the
>>> top first off.

Doing this means then doing a linear search through the remaining
99 floors in order - worst case O(n) drops. However it may be a
better average case answer.

> If you were doing the problem with cats, you should throw one off the
> top floor.

That's evil!

Richard
 
 
Richard Wheeldon





PostPosted: 2006-2-10 4:19:00 Top

java-programmer >> analytical Skill for Java Development Ingo R. Homann wrote:
> No, the opposite is true: You already know from the problem
> specification that it will break somewhere between floor 1 and 100. So,
> if it does not break on the 99th floor, you can be *sure* that it must
> break on the 100th floor!

Or the specification is wrong. That would be more like a real software
project :)

Richard
 
 
wolfgang zeidler





PostPosted: 2006-2-10 5:39:00 Top

java-programmer >> analytical Skill for Java Development Ingo R. Homann wrote:
> Hi,
>
> And I like this one:
>
> "How many points are there on the globe where by walking one mile south,
> one mile east and one mile north you reach the place where you started."
>
> Hint: The "obvious" answer ("There is one point.") is *wrong*!
>
> Ciao,
> Ingo
>

I found 3 answers and I think exactly 2 of them are correct.

1st answer, correct but useless:
number of solutions to go south-east-north in this way
*equals*
number of solutions to go north-east-south in this way

2nd + 3rd:
there is exactly one point *S* [/1/] with the following properties:
if you go 1 km north from S to A ( no matter which direction ) and
1 km east from A to B and
1 km south from B you'll reach S again.
For every distinct "S-A-B-S-circle"
the "B-S-A-B-circle" is a distinct solution of the
south-east-north-problem ( with fixed B-S-direction ).

2nd answer only:
there is a infinite number of solutions
because there is a infinite number of "S-A-B-S-circles".

3rd answer only:
there is a huge [/2/] number of solutions
because there is a huge number of "S-A-B-S-circles".

Remarks:
[/1/] the name *S* was *not* choosen because it's the *s*tarting point.
[/2/] http://en.wikipedia.org/wiki/Uncertainty_principle

regards ( from *munich*, i think you know why ), wz

--
http:\wzwz.de\mail
 
 
steve





PostPosted: 2006-2-10 6:52:00 Top

java-programmer >> analytical Skill for Java Development On Wed, 8 Feb 2006 16:42:07 +0800, Adam Maass wrote
(in article <email***@***.com>):

>
> "im" wrote:
>> On Wed, 08 Feb 2006 00:44:55 +0000, nospam wrote:
>>
>>> Hi...All,
>>>
>>> Recently I had been attending some interviews(almost after 10years)
>>> for Java Developer/Lead position. At each interview, 75% of the alloted
>>> time was spend was on problem solving sessions or checking the
>>> analytical skills. I was just wondering what has prompted the companies
>>> to include such a session & give so much importance to it.?
>>>
>>
>> Could you please post some examples of specific problems you had to solve
>> during the interviews?
>>
>
> 1) You have two identical glass balls; when dropped from a certain height,
> they will break. If they do not break, they are re-usable. Your task is to
> find which floor of a 100-storey building the balls will break on. Describe
> in words the algorithm you would use. We are interested in the time
> complexity of the algorithm; you should spend the majority of your time on
> this question attempting to optimize the algorithm.
>
> Hint: you can always do a linear search with one of the balls, though this a
> profoundly suboptimal solution to the problem.
>
>
> 2) You have many piles of rocks. The rocks in each pile are identical. There
> are an infinite number of rocks in each pile. You know that the rocks in one
> of the piles are slightly heavier than the rocks in all the other piles.
> (Say 1.1 kg instead of 1 kg.) You have a scale that you may use exactly
> once. Describe an algorithm to determine which pile contains the heavier
> rocks.
>
>
>

well the first one is the same as a simple binary sort. ,took just under 20
seconds to solve that one.

it's the same as having a sorted list , then finding a "break floor" directly
above a "non break floor"

the second one can be done by just taking a few rocks (same number form each
pile) adding them together then , looking at the total weight of each group
of rocks, which ever group is heavier, is the winner.

the infinite part is just shoved in there to mess you up.

that one took longer, the "infinite " threw me.




 
 
steve





PostPosted: 2006-2-10 6:59:00 Top

java-programmer >> analytical Skill for Java Development On Wed, 8 Feb 2006 19:09:42 +0800, Ingo R. Homann wrote
(in article <43e9d134$0$336$email***@***.com>):

> Hi,
>
> Andrea Desole wrote:
>> take 1 rock from the 1st pile, 2 from the 2nd, etc. The total weight
>> should be 1+2+3+...+n kilos. If it's .1 more the rocks from the first
>> pile are heavier, if it's .2 more the rocks from the second are heavier,
>> and so on. I knew the solution :-)
>
> Yes, this is easy.
>
>> I find the first one harder; I would probably go with a binary search at
>> the beginning to do it faster, until the first ball breaks, and then I
>> would do that linearly.
>
> As I explained in another post, this was also my first idea. But this
> fails: When you throw the first ball from the 50th floor and it breaks,
> you have to do a linear search from 1 to 49. That's hard.
>
> What do you think of my ideas explained in my other posts?
>
> Ciao,
> Ingo
>

why the hell would you need a linear search?

you know the ball breaks at the 50th floor , so that discounts 51-100

now you search again and start at 25, if it does not break at 25, you know
it is between 25 & 50

so repeat.

by keeping 2 pointers

broken = top limit
un-broken = bottom limit

by splitting the list eventually you WILL run out of numbers & un-broken will
be directly under broken, a simple split sort will do it.

unless you have a bug ;-)



 
 
Dimitri Maziuk





PostPosted: 2006-2-10 7:09:00 Top

java-programmer >> analytical Skill for Java Development Oliver Wong sez:
>
> "Dimitri Maziuk" <email***@***.com> wrote in message
> news:email***@***.com...
>> Roedy Green sez:
>>> On Wed, 8 Feb 2006 00:42:07 -0800, "Adam Maass"
>>><email***@***.com> wrote, quoted or indirectly quoted
>>> someone who said :
>>>
>>>>2) You have many piles of rocks. The rocks in each pile are identical.
>>>>There
>>>>are an infinite number of rocks in each pile. You know that the rocks in
>>>>one
>>>>of the piles are slightly heavier than the rocks in all the other piles.
>>>>(Say 1.1 kg instead of 1 kg.) You have a scale that you may use exactly
>>>>once. Describe an algorithm to determine which pile contains the heavier
>>>>rocks.
>>>
>>> Depends what you mean by a scale.
>>
>> Not really: a pile of infinite number of rocks (provided it does
>> not collapse on itself into a black hole as suggested upthread)
>> will contain all the matter in the universe and occupy all the
>> space.
>
> If there's an infinite number of rocks, this implies that there's an
> infinite number of matter in the universe, and thus that the universe itself
> is infinite.
>
> In an infinite universe, there may exist subsets of the universe which
> are themselves infinite. For example, maybe the universe is exactly composed
> the union of {an infinite number of rocks} and {an infinite number of
> scales}, in which case the rocks only make up "half" of the universe, but
> there's still an infinite amount of them.

More accurately, of "many" {pile of an infinite number of rocks},
one {scale usable exactly once}, one or more {interviewer}, and
one {interviewee}.

Which is why the right answer is to walk out: programming job in that
universe will probably entail banging rocks to make ones and zeroes.

Dima
--
One distinguishing characteristic of BOFHen is attention deficit disorder.
Put me in front of something boring and I can find a near-infinite number
of really creative ways to bugger off. -- ADB
 
 
Patricia Shanahan





PostPosted: 2006-2-10 12:11:00 Top

java-programmer >> analytical Skill for Java Development steve wrote:
> On Wed, 8 Feb 2006 19:09:42 +0800, Ingo R. Homann wrote
> (in article <43e9d134$0$336$email***@***.com>):
>
>
>>Hi,
>>
>>Andrea Desole wrote:
>>
>>>take 1 rock from the 1st pile, 2 from the 2nd, etc. The total weight
>>>should be 1+2+3+...+n kilos. If it's .1 more the rocks from the first
>>>pile are heavier, if it's .2 more the rocks from the second are heavier,
>>>and so on. I knew the solution :-)
>>
>>Yes, this is easy.
>>
>>
>>>I find the first one harder; I would probably go with a binary search at
>>>the beginning to do it faster, until the first ball breaks, and then I
>>>would do that linearly.
>>
>>As I explained in another post, this was also my first idea. But this
>>fails: When you throw the first ball from the 50th floor and it breaks,
>>you have to do a linear search from 1 to 49. That's hard.
>>
>>What do you think of my ideas explained in my other posts?
>>
>>Ciao,
>>Ingo
>>
>
>
> why the hell would you need a linear search?
>
> you know the ball breaks at the 50th floor , so that discounts 51-100
>
> now you search again and start at 25, if it does not break at 25, you know
> it is between 25 & 50

Suppose instead the second ball does break at 25. We now know the
critical floor number is in the range 1-25, but with both balls broken
there is no way to do any more tests.

Once the first ball has broken, the second ball must be used in an
ascending floor number scan of the floors that have not already been
eliminated. That is the only strategy that ensures that a test that
breaks it also gives the answer. The interesting part of this problem is
working out the strategy for using the first ball, given that limitation.

Patricia
 
 
Roedy Green





PostPosted: 2006-2-10 12:19:00 Top

java-programmer >> analytical Skill for Java Development On Thu, 09 Feb 2006 11:49:36 -0500, Eric Sosman <email***@***.com>
wrote, quoted or indirectly quoted someone who said :

>
> The problem of how to solve problems is itself
>solved, by Feynman's Algorithm:
>
> Step 1: Take a piece of paper, and write down
> everything you know about the problem.
>
> Step 2: Think really hard.
>
> Step 3: Write down the answer.

Thee is also the bottom up approach.

1. what part of the problem do I know how to solve.

2. write a class/method to solve it.

3. rethink that problem with your new abstraction thinking tool. It
should be clearer. At least your mind is cleared of worrying about the
part you already solved.

go to 1.

You gnaw away at he problem , and lo, eventually the solution is to
glue together 3 of the pieces you have created.

See http://mindprod.com/jgloss/tackling.html for a fuller discussion.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
 
 
Roedy Green





PostPosted: 2006-2-10 12:44:00 Top

java-programmer >> analytical Skill for Java Development On Fri, 10 Feb 2006 04:11:03 GMT, Patricia Shanahan <email***@***.com>
wrote, quoted or indirectly quoted someone who said :

>Once the first ball has broken, the second ball must be used in an
>ascending floor number scan of the floors that have not already been
>eliminated. That is the only strategy that ensures that a test that
>breaks it also gives the answer. The interesting part of this problem is
>working out the strategy for using the first ball, given that limitation.

That seems intuitively obvious, but how do you prove it? I think you
need some sort of reductio ad absurdam approach.

It also might be fun to see what happen when you turn a rules engine
e.g. Jess, loose on the problem. See
http://mindprod.com/jgloss/rules.html

--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
 
 
Patricia Shanahan





PostPosted: 2006-2-10 14:30:00 Top

java-programmer >> analytical Skill for Java Development Tony Morris wrote:
> As an experiment, give an "experienced" developer a problem and watch their
> analytical and problem solving skills seriously fail him/her. This of
> course, is the general case - there may be some corner cases where this will
> not occur.

This assertion is difficult to falsify because any experienced developer
with good analytical and problem solving skills can be classed as a
corner case.

Patricia
 
 
Thomas Hawtin





PostPosted: 2006-2-10 15:44:00 Top

java-programmer >> analytical Skill for Java Development Patricia Shanahan wrote:
> Tony Morris wrote:
>> As an experiment, give an "experienced" developer a problem and watch
>> their
>> analytical and problem solving skills seriously fail him/her. This of
>> course, is the general case - there may be some corner cases where
>> this will
>> not occur.
>
> This assertion is difficult to falsify because any experienced developer
> with good analytical and problem solving skills can be classed as a
> corner case.

There's got to be some extroverts out there.

Tom Hawtin
--
Unemployed English Java programmer
http://jroller.com/page/tackline/
 
 
Ingo R. Homann





PostPosted: 2006-2-10 15:53:00 Top

java-programmer >> analytical Skill for Java Development Hi wolfgang,

wolfgang zeidler wrote:
> I found 3 answers and I think exactly 2 of them are correct.
>
> 1st answer, correct but useless:
> number of solutions to go south-east-north in this way
> *equals*
> number of solutions to go north-east-south in this way

That is correct - although you get different points of course - but the
number is the same.

> 2nd + 3rd:
> there is exactly one point *S* [/1/] with the following properties:
> if you go 1 km north from S to A ( no matter which direction ) and
> 1 km east from A to B and
> 1 km south from B you'll reach S again.
> For every distinct "S-A-B-S-circle"
> the "B-S-A-B-circle" is a distinct solution of the
> south-east-north-problem ( with fixed B-S-direction ).
>
> 2nd answer only:
> there is a infinite number of solutions
> because there is a infinite number of "S-A-B-S-circles".
>
> 3rd answer only:
> there is a huge [/2/] number of solutions
> because there is a huge number of "S-A-B-S-circles".

Eh... I do not understand what you are trying to say.

So, what is your answer to the question(s)?:

(1) How many points are there?
(2) Where is/are this/these point/s?

> regards ( from *munich*, i think you know why ), wz

Hehehe,
Regards from Bielefeld (which *does* exist)

Ingo

 
 
Patricia Shanahan





PostPosted: 2006-2-10 22:29:00 Top

java-programmer >> analytical Skill for Java Development Roedy Green wrote:
> On Fri, 10 Feb 2006 04:11:03 GMT, Patricia Shanahan <email***@***.com>
> wrote, quoted or indirectly quoted someone who said :
>
>
>>Once the first ball has broken, the second ball must be used in an
>>ascending floor number scan of the floors that have not already been
>>eliminated. That is the only strategy that ensures that a test that
>>breaks it also gives the answer. The interesting part of this problem is
>>working out the strategy for using the first ball, given that limitation.
>
>
> That seems intuitively obvious, but how do you prove it? I think you
> need some sort of reductio ad absurdam approach.

Yes, if I were going to prove this I would assume a different strategy
and show that it can leave a lower floor unevaluated when the ball breaks.

Patricia
 
 
Patricia Shanahan





PostPosted: 2006-2-10 22:42:00 Top

java-programmer >> analytical Skill for Java Development moejo wrote:
>>As an experiment, give an "experienced" developer a problem and watch
>>their
>>analytical and problem solving skills seriously fail him/her. This of
>>course, is the general case - there may be some corner cases where this
>>will
>>not occur.
>
>
> So how can one learn better problem solving skills? In addition to
> problem solving, where can one find better algorithms to use?
>

Get an algorithms textbook, and read it. Don't just look at the
algorithms in isolation. Think about how they are put together. There
are design patterns they follow. For example, binary search is an
example of divide-and-conquer.

I'm not going to recommend a book, because the last time I bought an
algorithms book it was for a course, so I had to buy the one the
professor had chosen. I didn't look at any others.

I'm also convinced that problem solving improves with practice. The more
you think about problems and puzzles, the better you will be at it.

Patricia