all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
|
|
@ -0,0 +1,12 @@
|
|||
qsort <- function(v) {
|
||||
if ( length(v) > 1 )
|
||||
{
|
||||
pivot <- (min(v) + max(v))/2.0 # Could also use pivot <- median(v)
|
||||
c(qsort(v[v < pivot]), v[v == pivot], qsort(v[v > pivot]))
|
||||
} else v
|
||||
}
|
||||
|
||||
N <- 100
|
||||
vs <- runif(N)
|
||||
system.time(u <- qsort(vs))
|
||||
print(u)
|
||||
Loading…
Add table
Add a link
Reference in a new issue