Sale!

# COMP 272 Assignment 5 solution

Original price was: \$35.00.Current price is: \$28.00.

Category:

5/5 - (1 vote)

## Hash Table (20 points)

Given two arrays A and B, return whether array B is a subset of array A.
Input: [1,50,55,80,90], [55,90]
Output: true
Input: [1,50,55,80,90], [55,90, 99]
Output: false

## Priority Queue 1 (20 points)

Given an array A and integer k, return the k-th maximum element in the array.
Input: [1,7,3,10,34,5,8], 4
Output: 7
Priority Queue 2 (20 points)
Given two arrays A and B with n and m integers respectively, print all the elements in sorted order.
Input: [4,1,5], [3,2]
Output: 1 2 3 4 5

## Bloom Filter Hash Map (20 points)

Implement the following methods:
• contains
Complete the contains() method. The method will check the bits in the bloom filter map for each
of the ‘k’ hash codes based on the passed in parameter. It returns false if not in the set, else true if
most probably in the set.
Cuckoo Hash Map – (20 points)
Implement the following methods:
• put
Complete the put() method. This method should add a key-value pair to the table by means of
cuckoo hashing.

### Note:

• For the cuckoo hashing, the goal is to intentionally have you study the existing code in order to
write the put() routine. Do not wait till the last minute to work on this routine, factor in time
management.
• If you make a reasonable attempt, will give some credit. If no attempt, highest grade is
80%.

### Submission:

1) Before submission, make sure your code passes all the JUnit tests. Keep in mind, however,
that passing the test cases does not guarantee that your code is correct or efficient. Your
assignment will be graded considering test results, correctness, and efficiency.
2) The submission should be completed in Replit.
3) Include your name and class number as comments at the top of each submitted Java file.