implemented version sort algorithm