Note that the below two lines can also be this - subsets [ node -> data ] . child = node -> right -> data ; subsets [ node -> right -> data ] . sibling = node -> left -> data ; This is because if both left and right children of node - ' i ' are present then we can store any of them in subsets [ i ] . child and correspondingly its sibling
subsets [ node -> data ] . child = node -> left -> data ; subsets [ node -> left -> data ] . sibling = node -> right -> data ; } else if ( ( node -> left != NULL && node -> right == NULL ) || ( node -> left == NULL && node -> right != NULL ) ) { if ( node -> left != NULL && node -> right == NULL ) subsets [ node -> data ] . child = node -> left -> data ; else subsets [ node -> data ] . child = node -> right -> data ; }