Highlights
Exercise
This exercise has two parts. The first involves implementing in Java the Dynamic Set abstract data type using two different data structures. The second involves running an empirical study to compare the performance of each implementation.
Submission
Submit the Java sources of your implementations and a short (max 3 pages) report describing what you have done in each part of the exercise. Your report should include a heading stating your full name and matriculation number and clear instructions on how to run your code.
Part 1
The Dynamic Set is an abstract data type (ADT) that can store distinct elements, without any particular order. There are five main operations in the ADT:
• ADD(S,x): add element x to S, if it is not present already
• REMOVE(S,x): remove element x from S, if it is present
• IS-ELEMENT(S,x): check whether element x is in set S
• SET-EMPTY(S): check whether set S has no elements
• SET-SIZE(S): return the number of elements of set S
Additionally, the Dynamic Set ADT defines the following set-theoretical operations:
• UNION(S,T): return the union of sets S and T
• INTERSECTION (S,T): return the intersection of sets S and T
• DIFFERENCE(S,T): returns the difference of sets S and T
• SUBSET(S,T): check whether set S is a subset of set T
Implement in Java the Dynamic Set ADT defined above using
a) a doubly-linked list and [9]
b) a binary search tree. [9]
Explain in the report your implementation, noting the running time of each operation in both implementations. Note you can use a self-balancing binary tree but no extra marks will be awarded. Also, you are not allowed to rely on Java library classes in your implementation.
c) Suppose your implementation based on a doubly linked list maintains the list sorted. Explain in the report what are the implications of such implementation choice on the complexity of operations ADD and IS-ELEMENT?
d) A naive implementation of operation UNION(S,T) in the implementation based on BST consists in taking all elements of BST S one by one, and insert them into BST T. Describe in the report an implementation with a better running time. [5]
Part 2
a) Compare the two implementations of the Dynamic Set ADT by carrying out the following empirical study. First, populate (an initially empty) set S with all the elements from dataset int20k.txt provided on Moodle under Lab/Files. Then, generate 100 random numbers in the interval [0, 49999]. Finally, for each random number x record the time taken to execute IS-ELEMENT(S,x). What is the average running time of IS-ELEMENT over 100 calls in the two implementations of the ADT? Comment and explain your findings. [3]
b) What is the output of SET-SIZE(S)? [1]
c) What is the height of the BST implementing set S
This IT Assignment has been solved by our IT Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.
Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.
© Copyright 2026 My Uni Papers – Student Hustle Made Hassle Free. All rights reserved.