Level array store the number of Nodes on level i initially all values are zero
level = [ 0 ] * ( maxElement + 1 ) ; NEW_LINE for i in range ( N ) : NEW_LINE INDENT level [ arr [ i ] ] += 1 ; NEW_LINE DEDENT