Given Generic Tree
Node * root = newNode ( 1 ) ; ( root -> child ) . push_back ( newNode ( 2 ) ) ; ( root -> child ) . push_back ( newNode ( 3 ) ) ; ( root -> child [ 0 ] -> child ) . push_back ( newNode ( 4 ) ) ; ( root -> child [ 1 ] -> child ) . push_back ( newNode ( 6 ) ) ; ( root -> child [ 0 ] -> child ) . push_back ( newNode ( 5 ) ) ; ( root -> child [ 1 ] ) -> child . push_back ( newNode ( 7 ) ) ; ( root -> child [ 1 ] -> child ) . push_back ( newNode ( 8 ) ) ; int maxSumPath = 0 ;