if(root -> left != NULL and root -> right == NULL) {
Linkedlist leftLL = flatten(root -> left)
# leftLL.tail -> right = root; #
l.head = leftLL .head
l.tail = root;
}
and in main() {
Linkedlist l = flatten(root);
node * temp = l.head;
while(temp != NULL) {
cout << temp -> data;
# temp = temp -> right; #
}
}