Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Krishnan Sanjay
/
cmsc13600-public
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
db5be436
authored
Apr 29, 2021
by
Krishnan Sanjay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete bloom.py
parent
3c68f905
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
50 deletions
hw4/bloom.py
hw4/bloom.py
deleted
100644 → 0
View file @
3c68f905
'''bloom.py defines a bloom filter which is an
approximate set membership data structure. You
will implement a full bloom filter in this module
'''
import
array
import
binascii
import
random
class
Bloom
(
object
):
def
__init__
(
self
,
m
,
k
,
seed
=
0
):
'''Creates a bloom filter of size m with k
independent hash functions.
'''
self
.
array
=
array
.
array
(
'B'
,
[
0
]
*
m
)
self
.
hashes
=
self
.
generate_hashes
(
m
,
k
,
seed
)
#TODO
def
generate_hashes
(
self
,
m
,
k
,
seed
):
'''Generate *k* independent linear hash functions
each with the range 0,...,m.
m: the range of the hash functions
k: the number of hash functions
seed: a random seed that controls which A/B linear
parameters are used.
The output of this function should be a list of functions
'''
random
.
seed
(
seed
)
#TODO
raise
ValueError
(
'Not Implemented'
)
def
put
(
self
,
item
):
'''Add a string to the bloom filter, returns void
'''
#TODO
def
contains
(
self
,
item
):
'''Test to see if the bloom filter could possibly
contain the string (true (possibly)), false (definitely).
'''
#TODO
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment