Data Structure in Java
当前位置:以往案例 > >Data Structure in Java
2023-01-04

Note: don't use collections, like list, HashSet (TreeSet), and HashMap (TreeMap)
Write a program that implements a set of items (strings) using a singly linked list. A set is a collection of items in which no item occurs more than once. Your project should externally support the following methods:
Add a new item to the set. If the item is already in the set then nothing happens.
Remove an item from the set.
Return the number of items in the set.
Determine if an item is a member of the set.
Return a reference (node) to a specific node in the set (given a string)
Determine the union (i.e. set of all distinct elements) and the intersection (i.e. set of all common distinct elements) of two sets.
[extra points 3pts] Create different sets of different data types (for example, strings, integers, or other objects from other comparable classes).  Generics.
Include appropriate JUnit tests. (no main method)
Count the time it takes to execute each of the above operations. Note: To count the time use system.currentTimeMillis().

Programming Standards: 
See project rubric on canvas for details.
Deliverables: 
For JUnit tests check canvas.
Eclipse, use export project 
Use cs146F22.<lastname>.project1 as your package, and  don’t need a main method, only JUnit java tests. 
What to submit to canvas (Steps): 

Export your project on eclipse with your entire project (source code).  Otherwise include a Readme file.
Create a zip file named LastnameFirstProjectName.zip that includes the exported zip file + pdf report (or submit independently)
upload the last zip file to canvas.
All projects need to compile. If your program does not compile you will receive 0 points on this project.
Add meaningful comments.
Do not use any fancy libraries. We should be able to compile it under standard installs. Include a readme file on how to compile the project.
See Rubric.
Set1 -> {1, 2, 3} Set2 -> {3, 4, 5, 1}
Union -> {1, 2, 3, 4, 5} Intersection -> {1, 3}
Linked List 
1 -> 2 -> 3 -> null
1 -> 3 -> null


int max(int a, int b) { if (a > b) { return a; } else { return b; } }
char

Integer, String

int max(int a, int b){
return 0;
}


在线提交订单