find minimum element first