…………………….
https://www.youtube.com/watch?v=jadnFei9wtw
Complete binary tree property has this property that every level until last is fully filled and last level is filled from left to right. So, when we have a complete binary tree with $7$ nodes,
BFS goes level by level. So first three elements (say Set A) $=\text{level} _1$ nodes $(1)+ \text{ level} _2(2)$ nodes. DFS is go by connected manner. So first three elements (say Set B ) $= \text{level} _1$ nodes (1)$+$ one node from $\text{level} _2$ nodes $+$ one node from $\text{level} _3$ nodes which is connected to the previously chosen $\text{level} _2$ node.
$A – B =$ the remaining node from the set of $\text{level} _2$ nodes. $\implies |A – B| = 1.$
In |A-B| what is | | representing,
I think it is cardinality then why not n(A-B).
Someone clarify this doubt..
The answer is $1$. See the image below.
$A=\{1,2,3\}$
and $B=\{1,2,4\}$ or $B=\{1,2,5\}$ or $B=\{1,3,6\}$ or $B=\{1,3,7\}$
for all cases, $|A-B|=1$
@jugnu1337 Set is well defined collection of unordered distinct objects.
Set A will contain = { root node , 2nd level all node i.e 2 node}
Set B = { root node , one node from 2nd level , one node from 3rd level }
when we perform Set Difference operation :
A-B = one node from 2nd level.
and cardinality will be
|A-B| = 1
64.3k questions
77.9k answers
244k comments
80.0k users