I am C programmer and new to Python. In C, when we define the structure of a binary tree node we assign NULL to its right and left child as:
struct node
{
int val;
struct node *right ;
struct node *left ;
};
And when initializing a node, we write as:
val = some_value
right = NULL;
left = NULL;
Now my question is: how can we assign a NULL value to right and left pointers of the node in Python?
And how can we test against the Python version of NULL? In C it would be:
if( ptr->right == NULL )
None
None
, andis None
.