|
|
вернуться в форумThe solution is just printing 1,2,...,n, but how did you think it out? Re: The solution is just printing 1,2,...,n, but how did you think it out? Because the procedure P is sorting . Re: The solution is just printing 1,2,...,n, but how did you think it out? The tsar's program is quicksort algorithm it sorts input array and counts in how many swaps it was done (variable c)(not exact value but represents it)... Just try to think about variable c and you will realize that. So the solution is to print not only 1,2,...,n but ANY SORTED ARRAY OF LENGTH N Re: The solution is just printing 1,2,...,n, but how did you think it out? I resolve it by recursively fill the whole array. And I think out sorted array because I think it is easier to make the array sorted(since then the quicksort become bubble sort). Re: The solution is just printing 1,2,...,n, but how did you think it out? Re: The solution is just printing 1,2,...,n, but how did you think it out? Re: The solution is just printing 1,2,...,n, but how did you think it out? |
|
|