Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function BinaryTree() {
- this.root = null;
- }
- BinaryTree.prototype.addValue = function(value) {
- if (this.root == null) {
- this.root = new Node(value);
- this.root.x = width / 2;
- this.root.y = 50;
- } else {
- this.root.addNode(new Node(value));
- }
- }
- BinaryTree.prototype.search = function(value) {
- return this.root.search(value);
- }
- BinaryTree.prototype.traverse = function() {
- this.root.visit(this.root);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement