Avila University Create a Java Code Computer Coding Task


1 attachmentsSlide 1 of 1attachment_1attachment_1

Unformatted Attachment Preview

CS 111
Project 3
Spring 2020
Complete the project detailed in this document using valid, executable Java code. Submit your work (including only the .java
source code files indicated with in the specification below) to your lab instructor via eCampus no later than the deadline on the
course calendar. At the top of every file you submit, include a comment with your full name and the tracking code 2001-111-3
for instructor use. Your work is compared to the work of your peers and online sources to detect plagiarism.
The goal of this project is to reinforce key concepts of unordered data structures, hashing, and constant and logarithmic time
algorithms. It is also intended to reinforce the skills needed to implement a well-known but uncommon data structure.
You are given an interface Set (the source code is at the end of this document) that specifies the protocols for a set of string
elements which supports only adding elements and querying them for containment but no other operations.
Do not change the Set interface because any submitted copies are discarded. The instructors use their own copies of that interface
as given. Your work is expected to integrate with the given interface without any conflicts.
S T E P 1: I M P L E M E NT A T I ON
First, write a
class NaiveListSet implements Set that encapsulates a java.util.ArrayList as its data
structure using naive linear search (without self-organizing techniques) to ensure that the set never contains duplicate elements.
Second, write a class BloomFilterSet implements Set that encapsulates a java.util.BitSet as its data structure using
the behavior of a Bloom filter without removal. Start with 𝑚 = 101 bits, and start with 𝑘 = 3 distinct hash functions as follows.
One hash function must return an integer computed directly from the string element using an original algorithm you design.
One hash function must return a call to the hashCode method of the string element.
One hash function must return a call to one of the java.security.MessageDigest algorithms on the string element.
Any additional hash functions you write later may use original algorithms you design or MessageDigest algorithms.
S T E P 2: T E S T I NG
Create a class Experiment which includes a main method that conducts the following experiment in order.
Instantiate a String[] of size 10,000 (the sample data) and fill it with randomly generated strings that are at least 30 characters
long, generated using java.util.UUID.randomUUID().toString() calls.
Instantiate one NaiveListSet and one BloomFilterSet (the test subjects) to be used throughout the rest of this step.
For each test subject, add the first half of the sample data (the first 5,000 strings) to the test subject as elements. Measure the
average time each add operation takes in nanoseconds using the difference between System.nanoTime() calls.
For each test subject, query both halves of the sample data (all 10,000 strings) for containment in the test subject. Measure the
average time each query operation takes in nanoseconds, as above. Also measure the error rate for the query operation by
checking each query to see if it returns the correct answer and finding the ratio of the number of incorrect answers to the
total number of queries.
Your NaiveListSet’s error rate must be 0% because it must always answer correctly.
Your BloomFilterSet’s error rate is generally higher than 0% because it returns false positives for nontrivial sets.
Run your main method several times until the results stabilize and seem consistent over time. You must do this because the Java
virtual machine tries to optimize how it runs your code, and you only get consistent results after running it multiple times.
S T E P 3: O P T I MI Z A T I ON
Based on your testing results and research on Bloom filters, adjust 𝑘 and 𝑚 (but not the constant 𝑛 = 5,000 entries) for your
BloomFilterSet until it runs add and query operations faster than your NaiveListSet with an error rate of 1% or less.
Display your testing results (including the average add time for each test subject, the average query time for each test subject, and
the query error rate for each test subject) before the program terminates.
rev. April 6 – 1 / 2
Include comments in your source code explaining what you did to optimize your BloomFilterSet implementation.
You are graded on 1) the correctness of your implementation of the requirements in the specification above and 2) how effectively
you optimize your Bloom filter and explain those optimizations. The lab instructor determines the exact grading rubric to assess
your performance and may provide unit tests for your convenience.
For 50 bonus points, add a third set implementation to all four steps of the project as follows.
Write a class SelfOrganizingListSet implements Set that encapsulates a java.util.ArrayList as its data
structure using binary search and self-organizing in lexicographic order (that is, alphabetical order) to ensure that the set never
contains duplicate elements. You may reuse any suitable code you wrote for a lab assignment in this course and semester.
Your SelfOrganizingListSet’s error rate must be 0% because it must always answer correctly, and it must run add and query
operations faster (in logarithmic time) than your NaiveListSet which uses linear search (in linear time).
public interface Set {
* Adds the element to the set, or ignores the element
* if it is already contained in the set.
* @param element The element to add
void add(String element);
* Queries whether an element is contained in the set.
* @param element The element to query for containment
* @return Whether the element is contained in the set
boolean contains(String element);

Purchase answer to see full

information technology

java code

Computer Coding

User generated content is uploaded by users for the purposes of learning and should be used following Studypool’s honor code & terms of service.

Reviews, comments, and love from our customers and community:

Article Writing

Keep doing what you do, I am really impressed by the work done.



PowerPoint Presentation

I am speechless…WoW! Thank you so much!

Stacy V.

Part-time student

Dissertation & Thesis

This was a very well-written paper. Great work fast.

M.H.H. Tony


Annotated Bibliography

I love working with this company. You always go above and beyond and exceed my expectations every time.

Francisca N.


Book Report / Review

I received my order wayyyyyyy sooner than I expected. Couldn’t ask for more.

Mary J.


Essay (Any Type)

On time, perfect paper

Prof. Kate (Ph.D)


Case Study

Awesome! Great papers, and early!

Kaylin Green


Proofreading & Editing

Thank you Dr. Rebecca for editing my essays! She completed my task literally in 3 hours. For sure will work with her again, she is great and follows all instructions

Rebecca L.


Critical Thinking / Review

Extremely thorough summary, understanding and examples found for social science readings, with edits made as needed and on time. Transparent

Arnold W.




Joshua W.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>