> p<-runif(100,0,100)
> position<-function(p,left,right)
+ {
+ ch=p[left]
+ i=left
+ j=right
+ while(i<j)
+ {
+
+ while(p[j]>=ch&&i<j)
+ {j=j-1}
+
+ {
+ temp=p[j]
+ p[j]=p[i]
+ p[i]=temp
+ }
+ while(p[i]<=ch&&i<j)
+ i=i+1
+ {
+ temp=p[i]
+ p[i]=p[j]
+ p[j]=temp
+ }
+ }
+ p[i]=ch
+ return (i) }
> quicksort<-function(p,left,right)
+ {
+ if(left<right)
+ {
+ c=position(p,left,right)
+ quicksort(p,left,c-1)
+ quicksort(p,c+1,right)
+ }
+ }
> print(p)
[1] 70.2109356 23.2229310 55.9589015 88.3560980 16.3873316 51.1639351
[7] 24.9611950 95.7112153 52.2650148 15.2979143 73.9957755 37.1040484
[13] 84.4752610 45.3504229 6.0132963 14.2099394 54.3283803 45.6425801
[19] 11.6959808 64.7069964 34.1670299 27.9033357 95.2474008 71.2831944
[25] 56.0229940 13.5457678 50.6098039 49.3351473 43.1278305 59.6004731
[31] 40.7054852 72.1096626 86.8799710 16.5948064 25.7731950 44.1709756
[37] 86.5886568 76.6001450 34.5163265 50.1618490 28.1096952 56.9725382
[43] 39.3045214 96.5561596 64.6172029 83.8112331 57.8143109 16.0371765
[49] 70.2708381 27.9464554 3.6985003 20.4544107 50.4156327 82.9449672
[55] 39.2295394 74.2296771 48.7962310 16.0651336 8.4351208 57.8702368
[61] 42.9878993 79.8208326 64.0042727 88.3923224 75.4770234 57.0811214
[67] 61.6199970 69.4653060 69.4949887 68.7817395 57.5586543 67.2598059
[73] 55.8648105 83.1594391 97.3330077 9.0687329 65.0160189 10.3653066
[79] 46.0673450 19.7190146 48.0623542 28.0614926 92.7598999 69.1209554
[85] 73.1341345 0.5200688 83.1346664 96.3585349 26.5716380 22.1543035
[91] 47.3766706 62.0739943 20.6718482 24.2581804 8.1379289 50.5840062
[97] 67.7534163 48.3172179 92.3801011 39.6174103
>