Weighted algorithm
Weighted algorithm