bloomfilter

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 1 Imported by: 1

README

Bloom Filter in Go

A simple integer-based Bloom filter implementation in Go.

Go Report Card GoDoc License

Overview

A Bloom filter is a space-efficient probabilistic data structure used to test whether a given element is a member of a set. This implementation is designed for use with integers.

Installation

To use this Bloom filter in your Go project, you can install it using go get:

go get github.com/lovung/bloomfilter

Usage

Here's a simple example of how to use the Bloom filter:

package main

import (
	"fmt"
	"github.com/yourusername/bloomfilter"
)

func main() {
	var bf bloomfilter.BloomFilter[int]

	// Add some items to the Bloom filter
	itemsToAdd := []int{1, 2, 3, 4, 5}
	for _, item := range itemsToAdd {
		bf.Add(item)
	}

	// Check if an item may exist in the Bloom filter
	itemToCheck := 3
	if bf.MayExist(itemToCheck) {
		fmt.Printf("Item %d may exist in the Bloom filter\n", itemToCheck)
	} else {
		fmt.Printf("Item %d does not exist in the Bloom filter\n", itemToCheck)
	}
}

API Documentation

For detailed documentation, please refer to the GoDoc page.

Contributing

Contributions are welcome! Please feel free to open issues or pull requests for bug fixes, improvements, or new features.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BloomFilter

type BloomFilter[K constraints.Integer] uint64

func (*BloomFilter[K]) Add

func (f *BloomFilter[K]) Add(item K)

func (*BloomFilter[K]) MayExist

func (f *BloomFilter[K]) MayExist(item K) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL