Create minSetValue in O(nlogn)