Urb LeJeune wrote:

 express the algorithm in PHP or any
other programming language.

Huh? That is a mathematical, statistical problem of half-life periods. IMHO is not that useful unless providing the logic behind it is sufficient as an answer.

        That's easy for you to say :-)

        I'm not asking for a mathematical proof, just a logical proof.

OK, that wasn't clear to me.

My objection is about asking for an "efficient solution". I think it is much more important to stay with Confucius on this: the way is the goal.

        Again, any non-trivial problem will have multiple solutions.

Yes, exactly, but doesn't demanding an efficient solution mean that only one is correct whereas all others are not even if they work fine?

I'd say that someone who gets this requests and asks for a pen and paper to draw a picture is already a good candidate.

        What is a picture of this problem?

A diagram as shown for the NCAA basketball torunament pairings in the sports section of a newspaper. Or in my case the pairings for the German soccer cup.

Asking for an efficient algorithm and a mathematical approach is unfortunately in line how programming gets taught these days.

        I don't think you'll see that when we get to the "ideal" solution.

The ideal solution to the problem or the ideal solution to teaching programming? Assuming you mean this problem, it ends up to be a mathematical problem. My point was that figuring the problem out and then crafting the mathematical formula for it is IMHO a better approach than to start with a formula and then see if it fits the problem.


No wonder why people rather get MBAs instead of science degrees. Who wants to get beaten with the math stick each and every time? Use math and logic if common sense fails.

Let's assume I buy that approach, which I don't. What is the logic to solve this
problem?

Ah, there were several studies done in Europe asking high school graduates if they want to study science. Many said no citing the need for advanced math skills to be the main reason. I also inquired once about the results of the recruiting efforts for engineering students of one of the best German universities for science. They even went with a "science truck" to high schools showing off all kinds of neat stuff. Their efforts fell flat mainly because they told all the school kids they have to be good in math to be an engineer. I think that learning concepts and guessing right is way more important than learning theories and exactly calculating the 10th position after the period.
Maybe it is taught differently around here.

Now, the logic is like this:
Let's start with 4 teams (final four): we get two semifinals and one final, which makes for three games. Let's take 6 teams. First we get three matches and then have three teams left. One gets a bye, the two others play, for a current total of four matches and two remaining teams, which results into one final game for a total of five games. Now with 5 times four play and one gets a bye, having two matches down and three teams left. Two play one game, one gets a bye, for a total of three matches, two teams left, which brings a total of four matches.

So far odd and even start numbers as well as odd and even intermittent numbers are covered. Shows that the total of games is always one less than teams starting. That is something a fanatic, straight thinking ESPN watcher can figure out without ever attending any advanced math classes. OK, counting and the first rules of arithmetic proof to be helpful, but it is assumed that after 4th grade everyone knows that. I count that under common knowledge.


Writing the code was somewhat easy after I figured out what I need to do and in which order. In my case I also had to sync the changes with a database table, so I had to make sure that one thing worked before doing the other (I chose to first do the file system stuff, then change the db record, but the other way around is as good/bad).

Many years ago we learned to flow chart a problem before programming.

See above, I basically proposed a flow chart. And this is how I was supposed to learn ANSI C 12 years ago. My flow charts were great, my code sucked.

It is, unfortunately, a dying skill. In the early 1970s Edsger Dijkstra , one of the
great pioneers of computer science, delivered a paper in which he suggested
that the first programming course in a CS curriculum be taught without a
computer. When I first read the paper I though he was nuts. As time has
passed I am now of the opinion that the may was correct.

It is coming back to life, but today it is called UML and has flashy drag&drop applications. But this is exactly how I was introduced to computer programming. My 5th grade math teacher was a computer whiz (an Apple IIe specialist) and each exam had at least one task that started like this: "Stell' Dir vor Du bist ein Computer..." - Imagine you are a computer... I got Ds in math until I got a female (and pretty) math teacher in grades 11-13. My grades went from almost F to A. Whatever does it. ;) Even got the BSEE in below average time with an above average grade. As mentioned earlier, I also got a written warning for bad grades in English, now I am a tech writer at a US reasearch foundation. So much for concluding anything from test results.

Indeed an interesting discussion!

David
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to