In C++, a binary tree is represented using pointers, forming a hierarchical structure where each node can point to two further nodes: a left child and a right child.
This representation uses pointers to establish connected between nodes in the tree, allowing traversal and navigation throughout the structure.
struct Node{
int val;
struct Node* right;
struct Node* left;
Node(int val){
val= val;
left = right = null
}
}
https://takeuforward.org/binary-tree/binary-tree-representation-in-c/