node->root));
mid_print (node->root,0);
printf("\n");
}
}
*/
while(1)
{
// printf("into insert mode\n");
while( node->size< COUNT)
{
i=rand()%RAND;
insert (node ,i);
count=check(node->root);
if(count)
{
// printf("\ncheck error\n");
mid_print(node->root,0);
return ;
}
count=mid_print (node->root,0);
if(count!=node->size)
{
// printf("\n %d %d \n",count ,node->size);
return ;
}
if(error_label)
{
return ;
}
if(node->size==COUNT*2/3)
{
printf("%d %d \n",node->size,depth (node->root));
}
}
// printf("into delete mode\n");
while( node->size> COUNT/2)
{
i=rand()%RAND;
delete (node ,i);
count=check(node->root);
if(count)
{
// printf("\ncheck error\n");
return ;
}
count=mid_print (node->root,0);
if(count!=node->size)
{
// printf("\n delete error %d %d \n",count ,node->size);
return ;
}
if(error_label)
{
return ;
}
if(node->size==COUNT*2/3)
{
printf("%d %d \n",node->size,depth (node->root));
}
}
}
return 0;
}
摘自 chenbingchenbing的专栏