Starting from:
$30

$24

Lab 8 Hashtables with open addressing Solution

Problem 2




Design and implement ADT Set as an array of SmallSet values. Let M be the size of the array and N be sizeof(unsigned int). Then any subset of the universal set U = {0, 1, ..., (M*N)-1 } can be represented using ADT Set:




Given S  U, for any j  U, (j  S) iff ((j%N)th bit of S[j/N] is 1).




Implement typical set operations union, intersect, and difference for this Set ADT. You can use the following table for designing your functions.




Key
Function
Input Format
Description


0
readData
0MNXY
M represents the size of the array and N represents the size






A1 A2 A3 .. Ax
of unsigned int (taken as input for convenience) & M * N






B1 B2 B3 .. By
would represent the size of the set. X and Y represent the








sizes of two sets (A & B) respectively. You shall need to read








two sets (A & B) of integers, separated by a new line. Each set








contains values with space separation. Represent A and B in








the form of Set ADT described above.


1
Union
1
Perform union operation on A and B (C = A ∪ B) and print C.








You may sort C in ascending order first before printing.


2
Intersection
2
Perform intersection operation on A and B (C = A ∩ B) and








print C. You may sort C in ascending order first before








printing.


3
Difference
3
Perform difference operation on A and B (C = A - B) and print








C. You may sort C in ascending order first before printing.




Sample input and output
















Sample Input




Sample Output


0103256




24910343745587492


24923474




34


93745103458




247492


1










2










3


























































1 | P a g e

More products