function BFS (root) {
if (!root) return []
let stack = [root]
let result = []
while (stack.length) {
let node = stack.pop()
node && result.push(node.value)
node.left && stack.unshift(node.left)
node.right && stack.unshift(node.right)
}
return root
}
function DLR (root) {
let result = []
(function fn(node) {
if (node) {
result.push(node.value)
fn(node.left)
fn(node.right)
}
})(root)
return result
}
function secondDLR (root) {
if (!root) return []
let stack = [root]
let result = []
while (stack.length) {
let node = stack.pop()
node && result.push(node.value)
node.right && result.push(node.right)
node.left && result.push(node.left)
}
}
console