Hacker News new | ask | show | jobs
by lliwta 4334 days ago
> If you cannot code, you cannot check that your ideas work out on a computer.

Believe it or not, it's possible to write provable correct algorithms without writing a single test case :-)

Of course implementing is a useful sanity check. But it's not the important part -- it's not the skill set we should most emphasize in education.

> as in implementing the algorithm in code, not devising the algorithm in the first place.

Is there a particularly pressing reason to teach students who to translate pseudo-code from Wikipedia into <insert favorite language>? Sounds like a perhaps useful but pretty menial skill to me. Not the sort of core skill you'd organize a curriculum revision around for sure.

1 comments

> Is there a particularly pressing reason to teach students who to translate pseudo-code from Wikipedia into <insert favorite language>?

Yes, an avl balanced binary search tree can run faster on an artificial computer than on a natural one.

My point was that "copy an algorithm into programming language X" isn't something which needs to be taught in the first place, and isn't an economically valuable skill because literally anybody can be taught this skill in a few weeks.

If I had to choose between teaching why an avl balanced binary search tree works and forcing students to implement in a chosen programming language from pseudocode, I would choose the former every time. The intellectual maturity is far more valuable -- and harder to acquire -- than the rote skill.

> My point was that "copy an algorithm into programming language X" isn't something which needs to be taught in the first place, and isn't an economically valuable skill because literally anybody can be taught this skill in a few weeks.

That depends on the language, I doubt you could learn much about programming in a few weeks, it requires lots of practise.

> If I had to choose between teaching why an avl balanced binary search tree works and forcing students to implement in a chosen programming language from pseudocode, I would choose the former every time. The intellectual maturity is far more valuable -- and harder to acquire -- than the rote skill.

You are giving yourself a hard choice, just demonstrate both sides.

From personal experience, I've been looking at bst's recently. While messing around in my code, out of the blue I decided to write the struct for the node like this:

  typedef struct avl_node_typed {
    avl_node_typed *left, *right;
    void *data;
    unsigned height, population; /* avl algorithm requires height, not number of nodes */
  }avl_node;
Then I realised that using this algorithm:

  avl_node *search_index(avl_node *node, int index) {
    int x=0;
    if(node->left)
      x=node->left->population;
    if(index>x)
      return search_index(node->right, index-x-1);
    else if(index<x)
      return search_index(node->left, index);
    else
      return node;
  }
I could access the nth node in a tree. I had rediscovered the algorithm of order statistic trees, which can be treated syntactically like an array (this can be applied to all ordered trees, not just avl). During this time I was looking up knowledge on avl trees and coding away on my machine. If I was purely focused on the algorithmic side, I don't think I would have found it.
No one is denying the notion that coding can be helpful when writing algorithms.

But it doesn't follow that programming a machine is necessary for writing algorithms.

The machine can be and often is as much of a distraction as it is a tool when teaching CS.