Following is the code for searching an element in BST.
can anyone please explain what &(*cur)->right
or &(*cur)->left
means in the code?
Thank You
TreeNode *insertIntoBST(TreeNode *root, int val)
{
TreeNode **cur = &root;
while( *cur )
cur = (val > (*cur)->val) ? &(*cur)->right : &(*cur)->left;
*cur = new TreeNode(val);
return root;
}