added an O(n) algorithm to find the weighted median of a set