Normalization algorithm