coderwhy / JavaScript-Data-Structure

JavaScript讲解了数据结构和算法

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JavaScript-Data-Structure/数据结构08-树/01_二叉搜索树.html ---remove

littleant9414 opened this issue · comments

` bst.remove(9)
bst.remove(7)
bst.remove(15)

resultString = ''
bst.postOrderTraversal(function(key){
resultString += key + ' '
})
alert(resultString)`

  • 可以請問以上我輸出到chrome 為什麼出現Uncaught RangeError: Maximum call stack size exceeded at BinarySearchTree.BinarySearchTree.postOrderTraversalNode的錯誤?

  • 如果直接 alert(bst.remove(9)); alert(bst.remove(7)); alert(bst.remove(15));
    就會出現 undefined undefined false 的錯誤,why?