create a map of vectors to store Diagonal elements
map < int , vector < int > > diagonalPrint ; diagonalPrintUtil ( root , 0 , diagonalPrint ) ; cout << " Diagonal ▁ Traversal ▁ of ▁ binary ▁ tree ▁ : ▁ STRNEWLINE " ; for ( auto it : diagonalPrint ) { vector < int > v = it . second ; for ( auto it : v ) cout << it << " ▁ " ; cout << endl ; } }