Binary Search tree help
Can somebody explain to me what this code is doing step by step?, thanks

TREE-SUCCESSOR(x)
1 if right[x] ≠ NIL
2 then return TREE-MINIMUM (right[x])
3 y ← p[x]
4 while y ≠ NIL and x = right[y]
5 do x ← y
6 y ← p[y]
7 return y

Hi , the comments describe the code in a better way.
our job is to find the successor.

Binary Search tree help
Can somebody explain to me what this code is doing step by step?, thanks

TREE-SUCCESSOR(x)
1 if right[x] ≠ NIL
2 then return TREE-MINIMUM (right[x]) // if the node x has a right child , simply return that , that is the successor.
//now is the tricky part .. there is no node as the right child,
traverse back along the parent path , which ever node along the path has a right childe is the successor
3 y ← p[x] // y <- parent of x
4 while y ≠ NIL and x = right[y] // as long as y is not nil and the current node is the right child , we keep going to the top, if it is the left child , we simply return the parent y.
5 do x ← y // make the parent as the current node.
6 y ← p[y] // fetch the parent of the current node just set.
7 return y // this will return either NIL , if we shoot past the root of the tree or we are not the right child of the parent , left child implies this node will be the successor.

Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...

Hi I'm having a problem implementing a mini shopping cart drop down in the header to show the user all the products they have in their shopping cart. It seems the only solution for this is Ajax, and I've looked all over and can't find anything that I could possibly ...

Hi. Im using vb 2010. I want to dynamically add textboxes to my form by clicking on a button. I've google searched and so far this code worked:

Private Sub btn_addline_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_addline.Click
Dim txtB1 As New TextBox
Dim i
For i = ...