Merging child nodes to get parent node . Since set is used , it will remove redundant digits .
foreach ( int it in Tree [ 2 * idx ] ) Tree [ idx ] . Add ( it ) ; foreach ( int it in Tree [ 2 * idx + 1 ] ) Tree [ idx ] . Add ( it ) ; }