added the frequent algorithm