- Added Heavy Keeper Probabilistic Data Structure
- Top-K: What are the k most frequent values in the data stream?
using Probabilistic.Structures.TopKImpl;
/// <param name="k">Size of the Top items that you want be tracked</param>
/// <param name="depth">How many arrays you want to create to keep track of items fingerprints</param>
/// <param name="width">How many buckets we have inside each array</param>
/// <param name="decay">How often the items will be decaying</param>
HeavyKeeper<int> topk = new HeavyKeeper<int>(4, 5, 1000, 0.9);
// Add as many as you want
for (var i = 0; i <= 5; i++)
for (var z = 1; z <= i; z++)
{
topk.Add(z);
}
//{ Value: '1', Count: 5 }
//{ Value: '2', Count: 4 }
//{ Value: '3', Count: 3 }
//{ Value: '4', Count: 2 }
foreach (var item in topk.Top())
{
Console.WriteLine(item);
}
![image](https://private-user-images.githubusercontent.com/12010709/246724856-7c4f1450-867b-4978-9b1e-066ad7a32352.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQzNzU3NDYsIm5iZiI6MTcyNDM3NTQ0NiwicGF0aCI6Ii8xMjAxMDcwOS8yNDY3MjQ4NTYtN2M0ZjE0NTAtODY3Yi00OTc4LTliMWUtMDY2YWQ3YTMyMzUyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIzVDAxMTA0NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA0ZTE1OTE3OTY1NmZlZjQyMmQzNWNlYzhiNTA5ZmY1N2U3NmViYzg5N2M0MDI1OGE3YmRhNGNiZGYwZDE5N2UmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.lhYngKAY6ruaQ0l1m-N89ChAHNz73AgSyTUWpJTJpHc)
- Added Bloom Filter Probabilistic Data Structure
using Probabilistic.Structures.BloomFilterImpl;
BloomFilter<int> bf = new BloomFilter<int>(0.001, 1000);
bf.Add(1);
Console.WriteLine($"1 exists ? {bf.Exists(1)}"); //Possibly
Console.WriteLine($"2 exists ? {bf.Exists(2)}"); //No
![image](https://private-user-images.githubusercontent.com/12010709/246861948-50866c4a-7b24-4d9e-aac9-558191291ab4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQzNzU3NDYsIm5iZiI6MTcyNDM3NTQ0NiwicGF0aCI6Ii8xMjAxMDcwOS8yNDY4NjE5NDgtNTA4NjZjNGEtN2IyNC00ZDllLWFhYzktNTU4MTkxMjkxYWI0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIzVDAxMTA0NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWZiMWMwOTllMmM0OThkYjQxNDIyMGQ4N2JhNjU1NDJjOTA1YmYzNmExNjdiNGIxNTdiZTg4YTRmOTkxZjMwZTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.nqUNEYfCOC7ilTUAPiD38GzVCe0TbZWloJf-2blBeXo)