Bully algorithm implementation