Task Description: . (8 pts) Task 1: Add two methods: union and intersection to the interface BagInterface for the ADT ba
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Task Description: . (8 pts) Task 1: Add two methods: union and intersection to the interface BagInterface for the ADT ba
What to Submit? 1. Source codes for Tasks 1-5, which are "BagInterface.java", "ResizeableArrayBag.java", "LinkedBag.java", "ArrayBag Test.java", and "LinkedBag Test.java". Notes: • The class Node could be used as a member inner class of the class LinkedBag. Alternatively, it is fine to make class Node<T> an independent class and place in an additional java file "Node.java". Please use generics in your implementations. • Please test your source codes using the Eclipse IDE and see if the codes are executable. Non-executable programs will result in a grade of zero. Please properly comment java code to improve the readability. 2. (Optional) One pdf file, "Task6.pdf", if you complete Task 6, which includes Table 1 (as given on Page 2 of this assignment) showing the time complexities for Task 6 and Explanations for each of your answers. 3. Please zip all documents (if "Node.java" is used, there will be 6 java program files in total. 5 java program files otherwise) as yourname_p1.zip and submit it on Canvas.
Task Description: . (8 pts) Task 1: Add two methods: union and intersection to the interface BagInterface for the ADT bag. The detailed description of the two methods and how to call the two methods could be found on pages 2 and 3 of this assignment. Note: the two methods to implement are for Bags, not for Sets. (36 pts) Task 2: Implement the two methods, union and intersection, for the class ResizeableArrayBag. Note: the class ResizeableArrayBag presents an implementation of the ADT bag using a resizable array. Generics are needed! (36 pts) Task 3: Implement the two methods, union and intersection, for the class LinkedBag. Note: the class LinkedBag presents an implementation of the ADT bag using a linked chain. Generies are needed! (10 pts) Task 4: Write a client program. "ArrayBag Test.java", which contains a main method to test the two methods (union and intersection) you implemented for the class ResizeableArrayBag. • (10 pts) Task 5: Write a client program, "LinkedBagTest.java", which contains a main method to test the two methods (union and intersection) you implemented for the class LinkedBag. (Optional, Just for Extra Points: 10 pts) Task 6: Use Big O notations to indicate the time complexity of each method you implemented (the two methods implemented in Task 2 and the two methods implemented in Task 3) in the best case and the worst case, respectively. Please also provide explanation to each of Big O notations. Table 1. The time complexities of the two methods ResizeableArrayBag Time Complexity in the Best Case Time Complexity in the Worst Case LinkedBag union intersection union intersection