Skip to content
UPEEC

Coordinate Compression

Map large or sparse values to ranks $0..k-1$ so arrays and Fenwick trees can index them.

Intermediate
Comments 0

ranks = {v: i for i, v in enumerate(sorted(set(a)))}

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.