Hi i just want to ask about small point of implementing tree with c.This code is very berief and i just wonder, why did you fill with null parent attribute in c section on new_tree_node function.Other implementation sections have this code like parent = null.(at the new_tree_node() function) Another language
tree_node* new_tree_node(int data) {
tree_node *n = malloc(sizeof(tree_node));
n->data = data;
n->right = NULL;
n->left = NULL;
n->parent = NULL; // Shoulden’t be?
return n;
}
public TreeNode(int data) {
this.data = data;
this.right = null;
this.left = null;
this.parent = null;
}