d3.quickselect([..."how to select an array of strings"],10)
left=4
k=6// must be between >= left and <= right
right=8// inclusive!
input=[0,4,1,6,7,5,8,2,9,3]
result=d3.quickselect(input.slice(),k,left,right)
result.slice(left,k+1)
d3.quickselect(
[
{item:"Soup",note:4,emoji:"🍜"},
{item:"Cabbage",note:1,emoji:"🥬"},
{item:"Cake",note:5,emoji:"🍰"},
{item:"Ice Cream",note:3,emoji:"🍦"}
],
2,// k
0,// left
3,// right
(a,b)=>a.note-b.note// comparator
)
d3=require("d3-array@3")
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.