Number of steps needed to encode the most frequent symbol is $$O(1)$$.

Number of steps needed to encode the least frequent symbol is $$O(n^2)$$.