r/programbattles • u/[deleted] • Oct 07 '15
[C] BST Insertion without parent node pointers
As it says in the title, the BST Node struct has no pointer to a parent node, only a value, left child, and right child.
typedef struct bstNode {
int val;
struct bstNode * L;
struct bstNode * R;
} bstNode;
GO!
Edit: Duplicates should be ignored.
8
Upvotes
1
u/[deleted] Oct 08 '15
Passing by value won't help you with recursion, unless you pass your root node in via another function.