0

I need some help with a problem. I am attempting to insert numbers into a binary tree, then converted it to a rbtree, just curious on how i can change it over i know that

10 (black), 4(red), 5(black), 6(red), 11(red), 12(black), 13(red) as my input.

int a[] ={10, 4, 5, 6, 11, 12, 13}

the pseudo code that i got from the web is below for a tree-insert. Thanks in advance for any advice or code you can help with.

```
TREE-INSERT(T, z)
y = nil
x = T.root
while (x == 0)
y = x ;
if (z.key < y.key)
x = x.left;
else
x = x.right;
z.parent = y;
if (y == 0)
T.root = z;
if (z.key < y.key)
y.left = z;
else
y.right = z;
```