educative.io

Instructions and pseudocode are most helpful

I find it helpful when a site lays out pseudocode before presenting various languages. I think the trick is to memorize and understand the algorithms, and translate them into a language during an interview. Once I understand the algo inside and out, I’m ready for curveballs such as variations on a problem, ambiguous language, and implications that can be inferred from example input/output.

Here is an example topic “Inorder Traversal”. I’d consider the first block to be English instructions describing the approach. The last block is the sort of pseudocode I like.

(L) Recursively traverse L subtree.
(N) Process n itself (ROOT).
® Recursively traverse its R subtree.

Iterative Inorder Traversal

s = empty stack
while (not s.isEmpty() or node != null)
    if (node != null)
        s.push(node)
        node = node.left
    else
        node = s.pop()
        visit(node)
        node = node.right

Hi @mp0wr
I couldn’t agree more but it’s the author’s choice whether to put the pseudocode in the lesson or not. And your response will not go in vein, I will share your response to the authorities so that they will start requesting authors to consider it as well.

Thank you so much for the response and please keep giving us such wonderful suggestions.