Added weighted median function and tests

> `Base.median()` uses `select()` to avoid sorting the whole vector, but I don't know whether there's an equivalent function for `sortperm`.

A `selectperm` function would look like this (base off of `select` and `sortperm`)

```julia
import Base.Sort: Ordering, Perm, Forward, ord
selectperm(v::AbstractVector, k::Union(Int,OrdinalRange);
    lt::Function=isless, by::Function=identity, rev::Bool=false, order::Ordering=Forward) =
    select!([1:length(v)], k, Perm(ord(lt,by,rev,order),v))
```

Note that this does create a vector of `Int`s the sames length as `v`, but that's still probably better in most cases than copying the whole vector and sorting.

Example usage:
```julia
julia> x = rand(5)
5-element Array{Float64,1}:
 0.677481
 0.107243
 0.525638
 0.297544
 0.748513

julia> sortperm(x)
5-element Array{Int64,1}:
 2
 4
 3
 1
 5

julia> selectperm(x, 2)
4

julia> selectperm(x, 1:3)
3-element Array{Int64,1}:
 2
 4
 3
```


This could be submitted to Base if people though it were useful.