Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int node_insert(node_t *n, int data)
- {
- while (1)
- {
- if (data < n->data)
- {
- if (n->left)
- {
- n = n->left;
- }
- else
- {
- n->left = node_init(data);
- return 0;
- }
- }
- else if (data > n->data)
- {
- if (n->right)
- {
- n = n->right;
- }
- else
- {
- n->right = node_init(data);
- return 0;
- }
- }
- else
- {
- return 1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement