Increment the frequency of u
fre [ S [ u ] . charCodeAt ( ) - ' ' . charCodeAt ( ) ] ++ ; for ( let i = 0 ; i < adj [ u ] . length ; i ++ ) { if ( ! visited [ adj [ u ] [ i ] ] ) { DFS ( adj [ u ] [ i ] , adj , fre , S ) ; } } }