Skip to content

Instantly share code, notes, and snippets.

@AlexandreCantin
Created April 30, 2020 09:21
Show Gist options
  • Save AlexandreCantin/4594410ddc2518634f47f27ac7507092 to your computer and use it in GitHub Desktop.
Save AlexandreCantin/4594410ddc2518634f47f27ac7507092 to your computer and use it in GitHub Desktop.
// Structure de données encore inconnue
class Structure {
saveNode(node) {}
getNextNode() {}
}
// Fonction de traitement d'un noeud
var nodeStructure = new Structure()
function computeNode(node) {
if(!node) return;
computeNodeValue(node.value)
if(node.left) nodeStructure.saveNode(node.left)
if(node.right) nodeStructure.saveNode(node.right)
computeNode(nodeStructure.getNextNode())
}
// Création de l'arbre et début du parcours
var tree = new Tree(...)
computeNode(tree.root)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment