On-line Algorithms for Weighted Matching and Stable Marriages