View Single Post
Join Date: Nov 2008
Posts: 10
Reputation: mapidea is an unknown quantity at this point 
Solved Threads: 0
mapidea mapidea is offline Offline
Newbie Poster

Re: Binary Tree - Next Highest Value

 
0
  #3
Nov 18th, 2008
What will be the C# version of the below code.

int findSuccessor(self):
succ = None
if self.rightChild:
succ = self.rightChild.findMin()
else:
if self.parent.leftChild == self:
succ = self.parent
else:
self.parent.rightChild = None
succ = self.parent.findSuccessor()
self.parent.rightChild = self
return succ

int findMin(self):
n = self
while n.leftChild:
n = n.leftChild
print 'found min, key = ', n.key
return n
Reply With Quote