new algorithm equal_size