javascript binary search tree
1.0.0
一种简单的纯JavaScript BST结构强制,使用更新的返回来添加或删除项目。
var tree = new BST ( ) ; // Initialize
tree . add ( value ) ; // Add a new node
tree . remove ( value ) ; // Remove an existing node
tree . print ( ) ; // Print the tree as a text-pyramid in console
tree . min ( ) ; // Find smallest node
tree . max ( ) ; // Find largest node
tree . find ( value ) ; // Find node with given value
tree . destroy ( ) ; // Clears the root注意:要在使用tree.print()时保持间距,任何大于2位数/字符的值都将转换为标记为“ A”至“ Z”的传奇。标签和钥匙将被分开打印。
根据GNU通用公共许可证v3.0许可。它可以免费复制,使用和分发。