simplifying algorithm
completing new algorithm
fixing algorithm to consider thoses cases when all the elements happen with the same frequency