This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var left = [ | |
"apple", | |
"grape", | |
"grape", | |
"melon" | |
] | |
var right = [ | |
"grape", | |
"lemon", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Node(val, parent) { | |
return {parent: parent, val:val, left:null, right:null} | |
} | |
// Root | |
var two = Node(2, null) | |
// L | |
var one = Node(1, two) | |
two.left = one | |
var onefive = Node(1.5, one) | |
one.right = onefive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var V = ["A", "B", "C"] | |
var E = [ | |
["A", "B", 3], | |
["A", "C", 10], | |
["B", "C", 5], | |
["C", "A", -8] | |
] | |
BF(V, E, "A") |