Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are working on a web crawler application that needs to efficiently check whether a URL has been previously processed to avoid redundant processing. To
You are working on a web crawler application that needs to efficiently check whether a URL has been
previously processed to avoid redundant processing. To optimize this process, you decide to implement a
simple Bloom filter for URL caching. Your task is to create a program that adheres to the following
specifications:
Implement a Bloom filter with a configurable size and number of hash functions for URL caching.
Develop functions to add URLs to the Bloom filter and check whether a URL is likely to be in the filter.
Ensure that the implementation provides a consistent output for the same set of operations across different environments.
Your program should accept input in the following format:
For adding a URL: ADD url
For checking URL existence: CONTAINS url
Your program should produce output in the following format:
For adding a URL: Added: url
For checking URL existence: URL Existence Check for url: TrueFalse
Sample Input
Input will be taken from the fileinputPStxt
ADD https:examplecompage
CONTAINS https:examplecompage
ADD https:examplecompage
CONTAINS https:examplecompage
CONTAINS https:examplecompage
Note that the inputoutput data shown here is only for understanding and testing, the actual file used
for evaluation will be different.
Sample Output
Display the output in outputPStxt
Added: https:examplecompage
URL Existence Check for https:examplecompage: True
Added: https:examplecompage
URL Existence Check for https:examplecompage: True
URL Existence Check for https:examplecompage: False
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started