Hw3 - Randomized contraction algorithm