Hi,
I need to find out how many even values are contained in a binary tree.
this is my code.
private int countEven(BSTNode root){
if ((root == null)|| (root.value%2==1))
return 0;
return 1+ countEven(root.left) + countEven(root.right);
}
this i just coded as i do not have a way to test this out. I'm not able to test it out at th...
class Node:
'''represents a new node in the BST'''
def __init__(self,key):
self.key=key
self.disconnect()
def disconnect(self):
self.left=None;
self.right=None;
self.parent=None;
def __str__(self):
return 'node with kay %s'%self.key
class BST:
def __init__(self):
...
Hello All,
I have been using a driver to test one of my data structures(Binary Search Tree)
and i have come across this issue.
-It happens when i insert more than 2 objects into the bst
-What I am trying to do: I am inserting 4 objects into the tree, then i am deleting 2 objects, and then printing out my find method so that it displays ...
Hello All, I have been using a driver to test one of my data structures(Binary Search Tree) and i have come across this issue. -It happens when i insert more than 2 objects into the bst -What I am trying to do: I am inserting 4 objects into the tree, then i am deleting 2 objects, and then printing out my find method so that it displays w...