(Java) 15.9 Variant

#1

The solution to have O(1) read time and O(k) query time is a sparse array?

0 Likes

#2

Or a counting sort will be better suited?

0 Likes

#3

I don’t think it will work in either case.

0 Likes

#4

It is pretty simple that you just use a hash table for storing results, and traditional selection algorithm for most visited page.

0 Likes

#5

@tsunghsienlee can you elaborate ‘traditional selection algorithm’ part? I was wondering how it can achieve O(k) query time (suppose m >> k), thanks.

0 Likes