Skip to content

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

alexazor/Random-subset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Random-subset

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).

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

No packages published

Languages