Last chance! 50% off unlimited learning
Sale ends in
In one pass over the vector NA
s are handled according to parameter
na.last
by range_sortna()
, then, if the vector is unsorted,
binary quicksort is invoked.
quicksort2(x, na.last = NA)
a sorted vector
an integer vector
NA
removes NAs, FALSE
puts NAs at the beginning,
TRUE
puts NAs at the end
quicksort2(c(2L, 0L, 1L, NA, 2L))
quicksort2(c(2L, 0L, 1L, NA, 2L), na.last=TRUE)
quicksort2(c(2L, 0L, 1L, NA, 2L), na.last=FALSE)
Run the code above in your browser using DataLab