static void avl_verify_parent (avl_node * node, avl_node * parent) { if (node->parent != parent) { return; } if (node->left) { avl_verify_parent (node->left, node); } if (node->right) { avl_verify_parent (node->right, node); } }
void avl_verify_parent (avl_node * node, avl_node * parent) { if (node->parent != parent) { fprintf (stderr, "invalid parent at node %p\n", node->key); exit(1); } if (node->left) { avl_verify_parent (node->left, node); } if (node->right) { avl_verify_parent (node->right, node); } }
int avl_verify (avl_tree * tree) { if (tree->length) { avl_verify_balance (tree->root->right); avl_verify_parent (tree->root->right, tree->root); avl_verify_rank (tree->root->right); } return (0); }