rbtree

changeset 2:7205a7d8d3d6

tested iterative traversal
author John Tsiombikas <nuclear@mutantstargoat.com>
date Sun, 09 Oct 2011 07:55:51 +0300
parents 3b219820ebe8
children 53afe96233f2
files test/test.c
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/test/test.c	Sun Oct 09 07:52:04 2011 +0300
     1.2 +++ b/test/test.c	Sun Oct 09 07:55:51 2011 +0300
     1.3 @@ -390,6 +390,19 @@
     1.4  			glutPostRedisplay();
     1.5  		}
     1.6  		break;
     1.7 +
     1.8 +	case 'p':
     1.9 +		{
    1.10 +			struct rbnode *node;
    1.11 +
    1.12 +			rb_begin(tree);
    1.13 +			while((node = rb_next(tree))) {
    1.14 +				int key = rb_node_keyi(node);
    1.15 +				printf("%d ", key);
    1.16 +			}
    1.17 +			putchar('\n');
    1.18 +		}
    1.19 +		break;
    1.20  	}
    1.21  }
    1.22