Tree rotation algorithms

This is a discussion on Tree rotation algorithms within the C Programming forums, part of the General Programming Boards category; Can i get some good links /tutorials on tree rotation algorithms. Not exactly for balancing the tree.I need it just ...

1. Tree rotation algorithms

Can i get some good links /tutorials on tree rotation algorithms.
Not exactly for balancing the tree.I need it just to have a feel on rotations.

2. Code:
```     A
/    \
B      C

becomes

B
\
A
\
C```
think how you would do this step by step. what pointers would you change? do you need to keep temp pointers?

unless im missing something, thats about all there is to tree rotation. any algorithm would come from you deciding which way to rotate

3. Code:
```static void
pvt_left_rotate(struct clib_rb_t *pTree, struct clib_rb_node_t *x){
struct clib_rb_node_t *y;
y = x->right;
x->right = y->left;
if (y->left != rb_sentinel)
y->left->parent = x;
if (y != rb_sentinel)
y->parent = x->parent;
if (x->parent){
if (x == x->parent->left)
x->parent->left = y;
else
x->parent->right = y;
}
else
pTree->root = y;
y->left = x;
if (x != rb_sentinel)
x->parent = y;
}
static void
pvt_right_rotate(struct clib_rb_t *pTree, struct clib_rb_node_t *x) {
struct clib_rb_node_t *y = x->left;
x->left = y->right;
if (y->right != rb_sentinel)
y->right->parent = x;
if (y != rb_sentinel)
y->parent = x->parent;
if (x->parent) {
if (x == x->parent->right)
x->parent->right = y;
else
x->parent->left = y;
}
else
pTree->root = y;
y->right = x;
if (x != rb_sentinel)
x->parent = y;
}```
More Details: SourceForge.net Repository - [clibutils] Contents of /src/c_rb.c