Given N and K, produces and ordered random subset of [|1, N|] containing K elements. The elements are returned one by one. Time complexity is O(K*log(N)). Space complexity is O(1).
-
Notifications
You must be signed in to change notification settings - Fork 0
alexazor/Random-subset
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Given N and K, produces and ordered random subset of [|1, N |] containing K elements. The elements are returned one by one. Time complexity is O(K*log(N)). Space complexity is O(1).
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published