From 60e9e914872246d18c17deecd4a59e1b57a4ac53 Mon Sep 17 00:00:00 2001 From: sukanvisapearyoo Date: Wed, 15 Mar 2023 20:57:47 -0700 Subject: [PATCH 1/4] I think i am done --- .idea/uiDesigner.xml | 124 +++++++++++ .idea/vcs.xml | 6 + src/Main.java | 111 +++++++++- src/edu/greenriver/sdev333/BSTset.java | 208 ++++++++++++++++++ src/edu/greenriver/sdev333/HashSet.java | 11 + .../sdev333/SeperateChainingHashTableSet.java | 205 +++++++++++++++++ 6 files changed, 663 insertions(+), 2 deletions(-) create mode 100644 .idea/uiDesigner.xml create mode 100644 .idea/vcs.xml create mode 100644 src/edu/greenriver/sdev333/BSTset.java create mode 100644 src/edu/greenriver/sdev333/HashSet.java create mode 100644 src/edu/greenriver/sdev333/SeperateChainingHashTableSet.java diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/Main.java b/src/Main.java index 3e59c38..135b166 100644 --- a/src/Main.java +++ b/src/Main.java @@ -1,5 +1,112 @@ +import java.util.Scanner; +import edu.greenriver.sdev333.BSTset; +import edu.greenriver.sdev333.MathSet; +import edu.greenriver.sdev333.MathSet; +import edu.greenriver.sdev333.SeperateChainingHashTableSet; + public class Main { public static void main(String[] args) { - System.out.println("Hello world!"); + //System.out.println("Hello world!"); + //string created to put in set + String testString = "I L O V E K U M A"; //9 + + MathSet testOne = new SeperateChainingHashTableSet<>(); + + + //scanner to add string to BSTSet + Scanner input = new Scanner(testString); + + //testing isEmpty (true/false) + // System.out.println(testOne.isEmpty()); + + //loop to add the strings as keys to my testOne + while(input.hasNext()){ + String key = input.next(); + testOne.add(key); + } + + //Test for MathSet + MathSet testTwo = new SeperateChainingHashTableSet<>(); + testTwo.add("I"); + testTwo.add("t"); + testTwo.add("i"); + testTwo.add("S"); + testTwo.add("W"); + testTwo.add("h"); + testTwo.add("a"); + testTwo.add("T"); + testTwo.add(("i")); + testTwo.add(("t")); + testTwo.add(("i")); + testTwo.add(("s")); + + + //testing all methods in mathSet: return int + System.out.println(testOne.size()); + + //returns boolean + System.out.println(testOne.contains("B")); + System.out.println(testOne.contains("R")); + System.out.println(testOne.contains("o")); + // +// System.out.println(testOne.isEmpty()); +// System.out.println(); +// + System.out.println("__________________________________"); +// +// System.out.println(); +// // and again on testTwo + System.out.println(testTwo.size()); + System.out.println(testTwo.contains("A")); + System.out.println(testTwo.contains("K")); + System.out.println(testTwo.contains("a")); + System.out.println(testTwo.contains("T")); + System.out.println(testTwo.contains("z")); +// +// +// System.out.println("__________________________________"); +// +// System.out.println(); +// // this is the testOne for union/intersection/different methods + MathSet unionTester = testOne.union(testTwo); + System.out.println("union: testOne and testTwo"); + for (String element: unionTester.keys()){ + System.out.println(element); + } + System.out.println("__________________________________"); + System.out.println("intersection: testOne and testTwo"); + MathSet intersectionTester = testOne.intersection((testTwo)); + for (String element: intersectionTester.keys()){ + System.out.println(element); + } + System.out.println("__________________________________"); + + System.out.println("difference: testOne and testTwo"); + MathSet differenceTester = testOne.difference((testTwo)); + for (String element: differenceTester.keys()){ + System.out.println(element); + } } -} \ No newline at end of file +} +//IN CLASS +// +//// +//// //Create 2 sets +//// MathSet set1 = new BSTset<>(); +//// // add items to each of the sets (some same, some different) +//// set1.add("Ken"); +//// set1.add("Tina"); +//// +// MathSet set2 = new BSTset<>(); +// +// +// MathSet result1 = set1.union(set2); +// //test +// for (String key : result1.keys()) { +// System.out.println(key); +// } + + //set intersection + //set union + //set difference + diff --git a/src/edu/greenriver/sdev333/BSTset.java b/src/edu/greenriver/sdev333/BSTset.java new file mode 100644 index 0000000..60a7a93 --- /dev/null +++ b/src/edu/greenriver/sdev333/BSTset.java @@ -0,0 +1,208 @@ +package edu.greenriver.sdev333; + +class BSTSet> implements MathSet { + //fields + private Node root; + + //Node helper class + private class Node{ + private KeyType key; + private Node left; + private Node right; + private int N; // number of nodes in the subtree rooted here + + public Node(KeyType key, int N){ + this.key = key; + this.N = N; + } + } + + /** + * Puts the specified key into the set. + * + * @param key key to be added into the set + */ + @Override + public void add(KeyType key) { + root = add(root,key); + } + + private Node add(Node current, KeyType key){ + // current is the root of the subtree wer are looking at + + //we are at where we are supposed to be + if (current == null){ + //create new node + return new Node(key, 1); + } + + int cmp = key.compareTo(current.key); + // left + if (cmp < 0){ + current.left = add(current.left, key); + } + //right + else if (cmp > 0){ + current.right = add(current.right, key); + } + current.N = size(current.left) + size(current.right) + 1; + return current; + } + + + + /** + * Is the key in the set? + * + * @param key key to check + * @return true if key is in the set, false otherwise + */ + @Override + public boolean contains(KeyType key) { + Node current = root; + + while (current != null) { + int cmp = key.compareTo(current.key); + + if (cmp == 0) { + return true; + } else if (cmp < 0) { + current = current.left; + } else { + current = current.right; + } + } + + return false; //no matching in tree + } + + /** + * Is the set empty? + * + * @return true if the set is empty, false otherwise + */ + @Override + public boolean isEmpty() { + return root == null; + } + + /** + * Number of keys in the set + * + * @return number of keys in the set. + */ + @Override + public int size() { + return size(root); + } + + private int size(Node current){ + if (current == null){ + return 0; + } + else { + return current.N; + } + } + + /** + * Determine the union of this set with another specified set. + * Returns A union B, where A is this set, B is other set. + * A union B = {key | A.contains(key) OR B.contains(key)}. + * Does not change the contents of this set or the other set. + * + * @param other specified set to union + * @return the union of this set with other + */ + @Override + public MathSet union(MathSet other) { + // Create an empty set that hold the result + MathSet result = new BSTSet(); + + //add all element from this set + for (KeyType currentKey : this.keys()){ + result.add(currentKey); + } + //add all element from the other set + for (KeyType currentKey : other.keys()){ + result.add(currentKey); + } + return result; + } + + /** + * Determine the intersection of this set with another specified set. + * Returns A intersect B, where A is this set, B is other set. + * A intersect B = {key | A.contains(key) AND B.contains(key)}. + * Does not change the contents of this set or the other set. + * + * @param other specified set to intersect + * @return the intersection of this set with other + */ + @Override + public MathSet intersection(MathSet other) { + MathSet result = new BSTSet(); + for (KeyType currentKey : this.keys()){ + // if the key contains in the other set, add to result set + if (other.contains(currentKey)){ + result.add(currentKey); + } + } + return result; + } + + /** + * Determine the difference of this set with another specified set. + * Returns A difference B, where A is this set, B is other set. + * A difference B = {key | A.contains(key) AND !B.contains(key)}. + * Does not change the contents of this set or the other set. + * + * @param other specified set to difference + * @return the difference of this set with other + */ + @Override + public MathSet difference(MathSet other) { + // Create an empty set that hold the result + MathSet result = new BSTSet(); + for (KeyType currentKey : this.keys()){ + if (!other.contains(currentKey)){ + result.add(currentKey); + } + } + return result; + } + // iterate (walk through all items in this) +// Iterator itr = (Iterator) this.keys(); +// while(itr.hasNext()){ +// KeyType currentKey = itr.next(); +// if (!other.contains(currentKey)){ +// result.add(currentKey); +// } +// } + + /** + * Retrieves a collection of all the keys in this set. + * + * @return a collection of all keys in this set + */ + @Override + public Iterable keys() { + //create a new empty queue to hold my results + Queue queue = new Queue<>(); + + //start recursion, collecting results in the queue + inorder(root, queue); + return queue; + } + + private void inorder(Node current, Queue q){ + if (current == null){ + //do nothing - intentional + return; + } + + inorder(current.left, q); + q.enqueue(current.key); + inorder(current.right, q); + } +} \ No newline at end of file diff --git a/src/edu/greenriver/sdev333/HashSet.java b/src/edu/greenriver/sdev333/HashSet.java new file mode 100644 index 0000000..e0479d4 --- /dev/null +++ b/src/edu/greenriver/sdev333/HashSet.java @@ -0,0 +1,11 @@ +package edu.greenriver.sdev333; + +public class HashSet { + //Used SeparateChainingHashST as model/example + //^^^ code manage the "buckets" of hash table + + //SeparateChainingHashST depends on having SequentialSearchST + //^^^ code manage the insides of the buckets of the has table + // a linked list is inside each bucket + //will need to either bring in SequentialSearchST or write your own linked list +} diff --git a/src/edu/greenriver/sdev333/SeperateChainingHashTableSet.java b/src/edu/greenriver/sdev333/SeperateChainingHashTableSet.java new file mode 100644 index 0000000..0b73058 --- /dev/null +++ b/src/edu/greenriver/sdev333/SeperateChainingHashTableSet.java @@ -0,0 +1,205 @@ +package edu.greenriver.sdev333; + +import java.util.Iterator; +import java.util.NoSuchElementException; + +public class SeperateChainingHashTableSet implements MathSet { + + + private Node head; // first node in the linked list + private int size; // size variable for tracking size + + //fields + private class Node { + KeyType key; + Node next; + + /** + * Node class used in lunkedlist symbol table implentation + * @param key + * @param next + */ + public Node(KeyType key, Node next) { + this.key = key; + this.next = next; + } + + } + + /** + * Puts the specified key into the set. + * + * @param key key to be added into the set + */ + @Override + public void add(KeyType key) { + + for (Node current = head; current != null; current = current.next) { + if (key.equals(current.key)) { + return; + } + } + head = new Node(key, head); + + } + + + /** + * Is the key in the set? + * + * @param key key to check + * @return true if key is in the set, false otherwise + */ + @Override + public boolean contains(KeyType key) { + + for (Node current = head; current != null; current = current.next) { + if (key.equals(current.key)) { + return true; + } + } + return false; + } + + + /** + * Is the set empty? + * + * @return true if the set is empty, false otherwise + */ + @Override + public boolean isEmpty() { + + + return size() == 0; + } + + /** + * Number of keys in the set + * + * @return number of keys in the set. + */ + @Override + public int size() { + for (KeyType key : this.keys()) { + size++; + } + return size; + } + + /** + * Determine the union of this set with another specified set. + * Returns A union B, where A is this set, B is other set. + * A union B = {key | A.contains(key) OR B.contains(key)}. + * Does not change the contents of this set or the other set. + * + * @param other specified set to union + * @return the union of this set with other + */ + @Override + public MathSet union(MathSet other) { + MathSet result = new SeperateChainingHashTableSet(); + + //add all the elements of this se to the result set + for(KeyType currentKey : this.keys()){ + result.add(currentKey); + } + + // add elements of the other set to the result set if they are not already in the result set + for (KeyType currentKey : other.keys()) { + if (!result.contains(currentKey)) { + result.add(currentKey); + } + } + return result; + } + + /** + * Determine the intersection of this set with another specified set. + * Returns A intersect B, where A is this set, B is other set. + * A intersect B = {key | A.contains(key) AND B.contains(key)}. + * Does not change the contents of this set or the other set. + * + * @param other specified set to intersect + * @return the intersection of this set with other + */ + @Override + public MathSet intersection(MathSet other) { + MathSet result = new SeperateChainingHashTableSet(); + + for(KeyType currentKey : this.keys()){ + if(other.contains(currentKey)) { + result.add(currentKey); + } + } + return result; + } + + + /** + * Determine the difference of this set with another specified set. + * Returns A difference B, where A is this set, B is other set. + * A difference B = {key | A.contains(key) AND !B.contains(key)}. + * Does not change the contents of this set or the other set. + * + * @param other specified set to difference + * @return the difference of this set with other + */ + @Override + public MathSet difference(MathSet other) { + //create an empty set that will hold a result + MathSet result = new SeperateChainingHashTableSet(); + + for(KeyType currentKey : this.keys()){ + if(!other.contains(currentKey)){ + result.add(currentKey); + } + } + + return result; + } + + /** + * Retrieves a collection of all the keys in this set. + * + * @return a collection of all keys in this set + */ + @Override + public Iterable keys() { + return new Iterable<>() { + @Override + public Iterator iterator() { + return new SSIterator(head); + } + }; + } + + + /** + * helper iterator class used in for each loops + */ + public class SSIterator implements Iterator { + + private Node current; + + public SSIterator(Node head) { + current = head; + } + + @Override + public boolean hasNext() { + return current != null; + } + + @Override + public KeyType next() { + + if (!hasNext()) { + throw new NoSuchElementException(); + } + KeyType key = current.key; + current = current.next; + return key; + } + } +} \ No newline at end of file From 4504ba463ccde69f2daac6cf3eb52d13fba34321 Mon Sep 17 00:00:00 2001 From: sukanvisapearyoo Date: Wed, 15 Mar 2023 20:57:47 -0700 Subject: [PATCH 2/4] I think i am done --- .idea/uiDesigner.xml | 124 +++++++++++ .idea/vcs.xml | 6 + src/Main.java | 111 +++++++++- src/edu/greenriver/sdev333/BSTset.java | 208 ++++++++++++++++++ src/edu/greenriver/sdev333/HashSet.java | 11 + .../sdev333/SeperateChainingHashTableSet.java | 205 +++++++++++++++++ 6 files changed, 663 insertions(+), 2 deletions(-) create mode 100644 .idea/uiDesigner.xml create mode 100644 .idea/vcs.xml create mode 100644 src/edu/greenriver/sdev333/BSTset.java create mode 100644 src/edu/greenriver/sdev333/HashSet.java create mode 100644 src/edu/greenriver/sdev333/SeperateChainingHashTableSet.java diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/Main.java b/src/Main.java index 3e59c38..135b166 100644 --- a/src/Main.java +++ b/src/Main.java @@ -1,5 +1,112 @@ +import java.util.Scanner; +import edu.greenriver.sdev333.BSTset; +import edu.greenriver.sdev333.MathSet; +import edu.greenriver.sdev333.MathSet; +import edu.greenriver.sdev333.SeperateChainingHashTableSet; + public class Main { public static void main(String[] args) { - System.out.println("Hello world!"); + //System.out.println("Hello world!"); + //string created to put in set + String testString = "I L O V E K U M A"; //9 + + MathSet testOne = new SeperateChainingHashTableSet<>(); + + + //scanner to add string to BSTSet + Scanner input = new Scanner(testString); + + //testing isEmpty (true/false) + // System.out.println(testOne.isEmpty()); + + //loop to add the strings as keys to my testOne + while(input.hasNext()){ + String key = input.next(); + testOne.add(key); + } + + //Test for MathSet + MathSet testTwo = new SeperateChainingHashTableSet<>(); + testTwo.add("I"); + testTwo.add("t"); + testTwo.add("i"); + testTwo.add("S"); + testTwo.add("W"); + testTwo.add("h"); + testTwo.add("a"); + testTwo.add("T"); + testTwo.add(("i")); + testTwo.add(("t")); + testTwo.add(("i")); + testTwo.add(("s")); + + + //testing all methods in mathSet: return int + System.out.println(testOne.size()); + + //returns boolean + System.out.println(testOne.contains("B")); + System.out.println(testOne.contains("R")); + System.out.println(testOne.contains("o")); + // +// System.out.println(testOne.isEmpty()); +// System.out.println(); +// + System.out.println("__________________________________"); +// +// System.out.println(); +// // and again on testTwo + System.out.println(testTwo.size()); + System.out.println(testTwo.contains("A")); + System.out.println(testTwo.contains("K")); + System.out.println(testTwo.contains("a")); + System.out.println(testTwo.contains("T")); + System.out.println(testTwo.contains("z")); +// +// +// System.out.println("__________________________________"); +// +// System.out.println(); +// // this is the testOne for union/intersection/different methods + MathSet unionTester = testOne.union(testTwo); + System.out.println("union: testOne and testTwo"); + for (String element: unionTester.keys()){ + System.out.println(element); + } + System.out.println("__________________________________"); + System.out.println("intersection: testOne and testTwo"); + MathSet intersectionTester = testOne.intersection((testTwo)); + for (String element: intersectionTester.keys()){ + System.out.println(element); + } + System.out.println("__________________________________"); + + System.out.println("difference: testOne and testTwo"); + MathSet differenceTester = testOne.difference((testTwo)); + for (String element: differenceTester.keys()){ + System.out.println(element); + } } -} \ No newline at end of file +} +//IN CLASS +// +//// +//// //Create 2 sets +//// MathSet set1 = new BSTset<>(); +//// // add items to each of the sets (some same, some different) +//// set1.add("Ken"); +//// set1.add("Tina"); +//// +// MathSet set2 = new BSTset<>(); +// +// +// MathSet result1 = set1.union(set2); +// //test +// for (String key : result1.keys()) { +// System.out.println(key); +// } + + //set intersection + //set union + //set difference + diff --git a/src/edu/greenriver/sdev333/BSTset.java b/src/edu/greenriver/sdev333/BSTset.java new file mode 100644 index 0000000..60a7a93 --- /dev/null +++ b/src/edu/greenriver/sdev333/BSTset.java @@ -0,0 +1,208 @@ +package edu.greenriver.sdev333; + +class BSTSet> implements MathSet { + //fields + private Node root; + + //Node helper class + private class Node{ + private KeyType key; + private Node left; + private Node right; + private int N; // number of nodes in the subtree rooted here + + public Node(KeyType key, int N){ + this.key = key; + this.N = N; + } + } + + /** + * Puts the specified key into the set. + * + * @param key key to be added into the set + */ + @Override + public void add(KeyType key) { + root = add(root,key); + } + + private Node add(Node current, KeyType key){ + // current is the root of the subtree wer are looking at + + //we are at where we are supposed to be + if (current == null){ + //create new node + return new Node(key, 1); + } + + int cmp = key.compareTo(current.key); + // left + if (cmp < 0){ + current.left = add(current.left, key); + } + //right + else if (cmp > 0){ + current.right = add(current.right, key); + } + current.N = size(current.left) + size(current.right) + 1; + return current; + } + + + + /** + * Is the key in the set? + * + * @param key key to check + * @return true if key is in the set, false otherwise + */ + @Override + public boolean contains(KeyType key) { + Node current = root; + + while (current != null) { + int cmp = key.compareTo(current.key); + + if (cmp == 0) { + return true; + } else if (cmp < 0) { + current = current.left; + } else { + current = current.right; + } + } + + return false; //no matching in tree + } + + /** + * Is the set empty? + * + * @return true if the set is empty, false otherwise + */ + @Override + public boolean isEmpty() { + return root == null; + } + + /** + * Number of keys in the set + * + * @return number of keys in the set. + */ + @Override + public int size() { + return size(root); + } + + private int size(Node current){ + if (current == null){ + return 0; + } + else { + return current.N; + } + } + + /** + * Determine the union of this set with another specified set. + * Returns A union B, where A is this set, B is other set. + * A union B = {key | A.contains(key) OR B.contains(key)}. + * Does not change the contents of this set or the other set. + * + * @param other specified set to union + * @return the union of this set with other + */ + @Override + public MathSet union(MathSet other) { + // Create an empty set that hold the result + MathSet result = new BSTSet(); + + //add all element from this set + for (KeyType currentKey : this.keys()){ + result.add(currentKey); + } + //add all element from the other set + for (KeyType currentKey : other.keys()){ + result.add(currentKey); + } + return result; + } + + /** + * Determine the intersection of this set with another specified set. + * Returns A intersect B, where A is this set, B is other set. + * A intersect B = {key | A.contains(key) AND B.contains(key)}. + * Does not change the contents of this set or the other set. + * + * @param other specified set to intersect + * @return the intersection of this set with other + */ + @Override + public MathSet intersection(MathSet other) { + MathSet result = new BSTSet(); + for (KeyType currentKey : this.keys()){ + // if the key contains in the other set, add to result set + if (other.contains(currentKey)){ + result.add(currentKey); + } + } + return result; + } + + /** + * Determine the difference of this set with another specified set. + * Returns A difference B, where A is this set, B is other set. + * A difference B = {key | A.contains(key) AND !B.contains(key)}. + * Does not change the contents of this set or the other set. + * + * @param other specified set to difference + * @return the difference of this set with other + */ + @Override + public MathSet difference(MathSet other) { + // Create an empty set that hold the result + MathSet result = new BSTSet(); + for (KeyType currentKey : this.keys()){ + if (!other.contains(currentKey)){ + result.add(currentKey); + } + } + return result; + } + // iterate (walk through all items in this) +// Iterator itr = (Iterator) this.keys(); +// while(itr.hasNext()){ +// KeyType currentKey = itr.next(); +// if (!other.contains(currentKey)){ +// result.add(currentKey); +// } +// } + + /** + * Retrieves a collection of all the keys in this set. + * + * @return a collection of all keys in this set + */ + @Override + public Iterable keys() { + //create a new empty queue to hold my results + Queue queue = new Queue<>(); + + //start recursion, collecting results in the queue + inorder(root, queue); + return queue; + } + + private void inorder(Node current, Queue q){ + if (current == null){ + //do nothing - intentional + return; + } + + inorder(current.left, q); + q.enqueue(current.key); + inorder(current.right, q); + } +} \ No newline at end of file diff --git a/src/edu/greenriver/sdev333/HashSet.java b/src/edu/greenriver/sdev333/HashSet.java new file mode 100644 index 0000000..e0479d4 --- /dev/null +++ b/src/edu/greenriver/sdev333/HashSet.java @@ -0,0 +1,11 @@ +package edu.greenriver.sdev333; + +public class HashSet { + //Used SeparateChainingHashST as model/example + //^^^ code manage the "buckets" of hash table + + //SeparateChainingHashST depends on having SequentialSearchST + //^^^ code manage the insides of the buckets of the has table + // a linked list is inside each bucket + //will need to either bring in SequentialSearchST or write your own linked list +} diff --git a/src/edu/greenriver/sdev333/SeperateChainingHashTableSet.java b/src/edu/greenriver/sdev333/SeperateChainingHashTableSet.java new file mode 100644 index 0000000..0b73058 --- /dev/null +++ b/src/edu/greenriver/sdev333/SeperateChainingHashTableSet.java @@ -0,0 +1,205 @@ +package edu.greenriver.sdev333; + +import java.util.Iterator; +import java.util.NoSuchElementException; + +public class SeperateChainingHashTableSet implements MathSet { + + + private Node head; // first node in the linked list + private int size; // size variable for tracking size + + //fields + private class Node { + KeyType key; + Node next; + + /** + * Node class used in lunkedlist symbol table implentation + * @param key + * @param next + */ + public Node(KeyType key, Node next) { + this.key = key; + this.next = next; + } + + } + + /** + * Puts the specified key into the set. + * + * @param key key to be added into the set + */ + @Override + public void add(KeyType key) { + + for (Node current = head; current != null; current = current.next) { + if (key.equals(current.key)) { + return; + } + } + head = new Node(key, head); + + } + + + /** + * Is the key in the set? + * + * @param key key to check + * @return true if key is in the set, false otherwise + */ + @Override + public boolean contains(KeyType key) { + + for (Node current = head; current != null; current = current.next) { + if (key.equals(current.key)) { + return true; + } + } + return false; + } + + + /** + * Is the set empty? + * + * @return true if the set is empty, false otherwise + */ + @Override + public boolean isEmpty() { + + + return size() == 0; + } + + /** + * Number of keys in the set + * + * @return number of keys in the set. + */ + @Override + public int size() { + for (KeyType key : this.keys()) { + size++; + } + return size; + } + + /** + * Determine the union of this set with another specified set. + * Returns A union B, where A is this set, B is other set. + * A union B = {key | A.contains(key) OR B.contains(key)}. + * Does not change the contents of this set or the other set. + * + * @param other specified set to union + * @return the union of this set with other + */ + @Override + public MathSet union(MathSet other) { + MathSet result = new SeperateChainingHashTableSet(); + + //add all the elements of this se to the result set + for(KeyType currentKey : this.keys()){ + result.add(currentKey); + } + + // add elements of the other set to the result set if they are not already in the result set + for (KeyType currentKey : other.keys()) { + if (!result.contains(currentKey)) { + result.add(currentKey); + } + } + return result; + } + + /** + * Determine the intersection of this set with another specified set. + * Returns A intersect B, where A is this set, B is other set. + * A intersect B = {key | A.contains(key) AND B.contains(key)}. + * Does not change the contents of this set or the other set. + * + * @param other specified set to intersect + * @return the intersection of this set with other + */ + @Override + public MathSet intersection(MathSet other) { + MathSet result = new SeperateChainingHashTableSet(); + + for(KeyType currentKey : this.keys()){ + if(other.contains(currentKey)) { + result.add(currentKey); + } + } + return result; + } + + + /** + * Determine the difference of this set with another specified set. + * Returns A difference B, where A is this set, B is other set. + * A difference B = {key | A.contains(key) AND !B.contains(key)}. + * Does not change the contents of this set or the other set. + * + * @param other specified set to difference + * @return the difference of this set with other + */ + @Override + public MathSet difference(MathSet other) { + //create an empty set that will hold a result + MathSet result = new SeperateChainingHashTableSet(); + + for(KeyType currentKey : this.keys()){ + if(!other.contains(currentKey)){ + result.add(currentKey); + } + } + + return result; + } + + /** + * Retrieves a collection of all the keys in this set. + * + * @return a collection of all keys in this set + */ + @Override + public Iterable keys() { + return new Iterable<>() { + @Override + public Iterator iterator() { + return new SSIterator(head); + } + }; + } + + + /** + * helper iterator class used in for each loops + */ + public class SSIterator implements Iterator { + + private Node current; + + public SSIterator(Node head) { + current = head; + } + + @Override + public boolean hasNext() { + return current != null; + } + + @Override + public KeyType next() { + + if (!hasNext()) { + throw new NoSuchElementException(); + } + KeyType key = current.key; + current = current.next; + return key; + } + } +} \ No newline at end of file From b1edf184cffbe2ce2cc0eee9bf92d8a95663ed74 Mon Sep 17 00:00:00 2001 From: sukanvisapearyoo Date: Mon, 20 Mar 2023 13:25:45 -0700 Subject: [PATCH 3/4] 4th commit/push --- out/production/FinalProject/Main.class | Bin 0 -> 2657 bytes .../edu/greenriver/sdev333/BSTset$Node.class | Bin 0 -> 840 bytes .../edu/greenriver/sdev333/BSTset.class | Bin 0 -> 4689 bytes .../sdev333/FlightRoutesGraph$Edge.class | Bin 0 -> 723 bytes .../greenriver/sdev333/FlightRoutesGraph.class | Bin 0 -> 3238 bytes .../edu/greenriver/sdev333/HashSet.class | Bin 0 -> 292 bytes .../edu/greenriver/sdev333/MathSet.class | Bin 0 -> 687 bytes .../sdev333/Queue$LinkedListIterator.class | Bin 0 -> 1322 bytes .../edu/greenriver/sdev333/Queue$Node.class | Bin 0 -> 673 bytes .../edu/greenriver/sdev333/Queue.class | Bin 0 -> 1943 bytes .../sdev333/SeparateChainingHashTable.class | Bin 0 -> 3968 bytes .../sdev333/SequentialSearchST$Node.class | Bin 0 -> 991 bytes .../greenriver/sdev333/SequentialSearchST.class | Bin 0 -> 2067 bytes src/Main.java | 10 ++++++---- ...Table.java => SeparatingChainHashTables.java} | 15 ++++++--------- 15 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 out/production/FinalProject/Main.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/BSTset$Node.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/BSTset.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/FlightRoutesGraph$Edge.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/FlightRoutesGraph.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/HashSet.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/MathSet.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/Queue$LinkedListIterator.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/Queue$Node.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/Queue.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/SeparateChainingHashTable.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/SequentialSearchST$Node.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/SequentialSearchST.class rename src/edu/greenriver/sdev333/{SeparateChainingHashTable.java => SeparatingChainHashTables.java} (92%) diff --git a/out/production/FinalProject/Main.class b/out/production/FinalProject/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..e2ac6068cc98f56bad13b0ebefd8a183cd14213e GIT binary patch literal 2657 zcmai0TX0iV6kR7xdvDTb&)Q)qqR z8}VHqBcFcp<%fQhsmw6?;|%=yqvP=5jKBKtjE>+sH;*>d+I-x-_c?p7v-djtoRhov zzr77$A3pcPg9;5^1C^)}sJUp4n~{`h4@G(gFUo`?P}OGHmeVd!5pL?&p$jbQ48=k{ zq5jaJ(DBfzP*86>LPU4joMWXT@q}sHGUJDVr7Ec!f#u=YY+7+ALyXp@e&rD`P>VVNZP?6q z%gfA`NuE_R^#)d8rGVFVhwH*k^D(N?fK?h+8+a6J1lBB&f0yYD$ECtHlgWp&$&k_L4C`p7Fm-IF=+m)-BJ0CrXwk6Cz;5g*+lKf= z){&!JJe^|-%kx!O=}0eWa7czUM_W}Pj~jRbQ5KxFCZ)?mryp(Dr=i`zemp5q>ylU= zO6tZGP|9XxxKq_}fcYFyh))?fgu?=QB5ga|y6ghAlkYYhRf}{gkh2QpI6+S8=%PsL z=n+_Ve$k(TIiX-`bi^6hq2mlhbUo3t)mkQr$wVnjV&&@x}P5tb7ZjXYR zCBAT3u*+pij!K&+$ZKYX2wM9e7))C=Kt6~ug>DcCE!ITrNXs5m2edZ7`rNCGnY&PI zCV^_V)B3oKWDf-9l3X0DndPoHR9{Zd#8{D{U5jMaHlK`k=CdU3n2C`tbF9F$Kc3EI z67sN>;_mnq-P;w3Xv8Gn2lexSHKK~&7imQ(1!d)yn-E{S(=YL>rq%alevP~XUcnVw zKD>(8IKtqHUr+%*5vv1Q>=t|jH&NYn3&z0Kn|P#q+ccJ4M;*oTsJA)jok7rp8xMXj zI7YoeZ(yxENTso;tS>4Xi^}Gr(o|Ho7L{#9r4%(EC*t~igPqMY*efuNR;33zW^m9$ z>xgR|E3;yAtU&iPdg-I`FNHJVlXHA%_LZB=u!PQ8<~i5wFPbhZXFP~ja)rRtTq#&N zgJ%V1FenhM3RcZvSl~Julr|#p9qg#4veD>!2 zf5smCiYWd-EB;2C@ME6{qFscsU+m?J*MTFV6Gz1;AG92fiOYP>t{^6^@;#eEx0vRG zb{oCodz=t=_*DIfK5>t4)dTcNMCI8Z;Oy?u#w1M#K6Gp?|R1 PH6PZQ^QVmV;In@Lt}|}_ literal 0 HcmV?d00001 diff --git a/out/production/FinalProject/edu/greenriver/sdev333/BSTset$Node.class b/out/production/FinalProject/edu/greenriver/sdev333/BSTset$Node.class new file mode 100644 index 0000000000000000000000000000000000000000..dfd2ae0af0581b24d347fd419bc5d25ac1c8d8aa GIT binary patch literal 840 zcmaJ<-*3`T6#i~0gR+h>hSRCIA2J0rs|inrxd%y%M1l_x-V0n=XV)&bg#`aAABc$$ z{sI0`#_yH|qcLsLo_^a((dXM0um;{NaO1h6 zKx_CxE{Dro*%mN;`H6*U=~9!<$ad0c7n{VF=Xw^5$SQAk#R9ME>7niax6*BlsIimG zb+_jQvOm8WOEuJe3Y2@{#Pvt6@-)74ntJ?tHh-P5+q?6f`bK4vy)X#pY9ilxI^*_w zljnM_0{Om-;`d<`=kQFRnz~H^yBh>jb$mC9Bn6my0yyR_^1Mq~T5b*k_lOJ}@V$=* z8+=Io@E^haS*P?Gc#2wL&+weK LK%EB8P>1mwpgywM literal 0 HcmV?d00001 diff --git a/out/production/FinalProject/edu/greenriver/sdev333/BSTset.class b/out/production/FinalProject/edu/greenriver/sdev333/BSTset.class new file mode 100644 index 0000000000000000000000000000000000000000..e539f752c048bfbd09fb802bfe5f77168fb0ec64 GIT binary patch literal 4689 zcmc&%-&0&?8GgRqvpKMPAP{I`()=I+3G9+UlUfanGzlS=mZgbMN@zuv-2;Ubi>B>7U?LCR(5Od}ntLmIWLyyx8-7 z=R5DO=lS0E{l5Lnzkc_70AI!HQG^gSVOWS@k3!S+^lG|yDeW%wK09~a&J-2)3^=Y+ z98?H*bx+o#4)rFY7Gkgzj@a2!??T?T-Mq7E=X(oTd-d$uv%MF`Cki%ojeIW0p<{Gg zxsI`1)=oxgy3xX3G|^Q$n^l{2ydil>n)1maeT?d6BfRVuPE%R!Yqp@)Hxzu z%;f`CN=0X>*AwA-GKPL6O$=DfW+th&vPne2Tuc|n>|4x4=J2#=oVRcR7a5`JEw^rp z&?hj4OBgnBS#t7g3P)??Nh)1j9G7I@auX)SN}oKQw(tx_2`Q6vi)qItF9g#FHNTNj=cMeMsd+0+sC$dlazYgq)nH;h4}WWfe2}( zz7ns3)m3@vCTcTN%I9rY5;3#9qR=p2OlNMS(ks3nXNTPjIMP&9t?xR*GKay?rX__6 z!^{mW!NPB90?YaTCt7(rQPf#b4`6?mL_>_oH9{JhOP$S`9gUU9L#)CyMD zq(V)Xp1@{@$2aw}ay#8Dqi!m^P!n^F(%Ux3pnb`9XTUGq{{BG!ueOVz{9r)B@4vNt zZAo!-JXgwR?8}aHftZf|w45k>8?y_=lr3F?UBDV~T{}Otlr9u(z8ca|aGYH$1jR0` zIPz-4@f*A#g)oCg&UrWD^P60`z)^9G#P319%}E%ue9C8;r}-3R3SbTyj@eBsHs9E{ z@FGo%xj7h|0gdr^{2iEybu_#SvuanaXW(_90f#-?`?a)hn|gAcphfXg{U%=Yw|Rck zKo+RUyA_|}_aBVU;5e1|0FC$2d@bH%+(XM-J&AX)e*=d?7(DWGv?StuZ|m`*YFk6= zkzb(6TWi;A?OI?Rog&!Ian_i97xBbfv~76IbfTW~6MXBS|C2a`ZeDBRIE_;{!{?Le z<2mz~hc2#Ts-T;~qR-}(hciU&K{(V5dx+aO5(DKmVv(Qm*cbVEV!h7qyp-&Hh@+~> zXW|AWc#8Q`UMzOOpy2*R>XQpE~R{mNr51B5M#DR z!grZ!@hbg|UJ_)v88*vs(KD_~A?6#WqMu0BGLdhZPWdKDBXGh{dwkk*Tw1|R9f4}+ z7@@$-ebimMhtsL}I(j#7R$=Va2F@w`3Sqt3a^V`gyJItMzStGCDDqdygewY2@H4o_HjH;7Td3FJVU&}K_S^+~%SM}WA55H}Jcov|v19|edx#61SyAebK#_>V}+k8ut^!2o{h5h5+56D>X=QkJ?6 z%dAYp69F2k@*2FzYw#kk!Hawu{9c4B;5#1>obIjy`u6_{`pxY@|B9g32=3Pe{TqV* zEkWP?e}m@#Jdz+qdV|#?McQ&7DVE5yqvaFrigz054xo$m4@B}l|BL=HP^>NfM%A%c zUt-n=&oucao1(wn;Wy3t%XG;9KYjqeWB_s=w6RMVZ)LZ}n literal 0 HcmV?d00001 diff --git a/out/production/FinalProject/edu/greenriver/sdev333/FlightRoutesGraph$Edge.class b/out/production/FinalProject/edu/greenriver/sdev333/FlightRoutesGraph$Edge.class new file mode 100644 index 0000000000000000000000000000000000000000..f1a199e49cccb1e0d34e405b0aba49197054135c GIT binary patch literal 723 zcma)4OHbQC5dOwC6T^DF z?w>|7?CU?tK#TND1^4~R&t519v$`+S$|1pPO^a;gkwq?pyo))wgyL;54E!jFL;qLj zR&+IYJ(jW5Cj`5?+cq06xG11Vn2D2~_)aLbK0sGm$vAA7vXYCX_p&3x@9OkhO?I5j z?6wI`lUE=VS~3=wgS(DUe}hiMnNln122ndu(!~Fhj^T&kPrb*O*9MQdQOO;_(g`7d zl?+r@oJupMJaLKx!v!IGDN=o&q&kC5LUr165ZsG67OEKqX)1VE$6OYhOlOwAh|QL% zXU{U+0>z^FDI62a9F|$HaCFV@4%=mKZv^rlk@5CNnD=TUEIy3UW!9y)8sr$WfHHUd r!~&jX8!SF!m96o<@GNWWt+8jbtaD`HE542G2DaGddAfxSY{Pm5c(1E; literal 0 HcmV?d00001 diff --git a/out/production/FinalProject/edu/greenriver/sdev333/FlightRoutesGraph.class b/out/production/FinalProject/edu/greenriver/sdev333/FlightRoutesGraph.class new file mode 100644 index 0000000000000000000000000000000000000000..79a37fe844273915e5ea83a69e41d0a68c75bd09 GIT binary patch literal 3238 zcmbVOYf}?f7=8`}62giYBovB@iV6fx6|~mSS_vR%2x1U#wRK6BWFhS0?uJV3)!y&- zR)0aiwjD2{&UF0T-_uV{Z_n8c7=&o2voq)Vp69&pbDsB{{r&H|zX5n2*Mq1)r5`>8 zRj3xIpHUaoXkIn4(Xpu+E$s+Y_vwc2ydY57(K+cyKwy)WDMYiDrWuyLpjlBnqb>CG z^hEnp6Sn3A;YVc+YN7bCPC*^k3v`rOF_hP{Ip?HVa5Vd(MiHkUCPR&8k%M7@k|V|l|On)ElUph-GgrDd|3U5f@ZD`>&fj9krR1R6UM zkFpb!jBFCvUB-=7@wE>UJBU_nk%YGijCYiabJf~d$@VG7(v9pIBb}4d@ofsWqg}u^ zt1Xhta7Sm!+7U;y)Tz7{tHn<2@}omRC%Obe52IT$5eVqg+A*yXl!Bw@qpk_ZiPDYT ze(X^Y#WPDND@+9ZIn_>Tm#HR-=$u@!PeBiQ>7n5cZ(QM_C%sq=c{-rrSsX0NVlUxK z0x6OZ#34`(eG2tVnU+Y{GoXaEO9eGgBGx>@b8?>-6&zXKXJ3$Vs0?6${vI1TE_*`? zj$)XRPzp&Z^bxG0E1i=89OI&~lLG-H*f=tg2q4MEXnZVy6Ktdgj|6a%je)_W1fEcE z3X>kN6oeYH`y@tIlcN$+2ZSs^NH! zl}VK)FG`hK3_gfyWc|n~(B%;{xH?_AJ^7oL&g6{{1f~RPQhL@z77q{Lg5KNnf!TVe{4T0!?2J}1^5OlG|cqp*&N_Q9Mmt0<#a@6$f zs5)N^VfcS2vCMh+=2V@|hda)%KCez@kWaO;WUFC~X$FuLSeMZ)QZQthb4?FrMIEzGZR>z5F+V&Mc2 zW)1UFhKhG>Y1$Pb;%Yvh;`JX3;7fs)0hheCY4^#t+os848)-b$CIa}n%sgr3Jg=t_ ziqDGYRoj+tyH8$peta*mV-+=PMeN6qe8C@Y%3I!}2U~eBR`52e;K#oY-UqX8FV8+7 z_~rf_UtlH(s#zMem_Q|4z~-*o5MB4+KYJTBHxXpBp3TsGG~7hvFD{nJG6WyXtt__@ zbvrhp9rGMfJQQ4l#h#GwMsbI@>l0Ahbpyf39XwTmhj8*w42U4e*HOZR-F|HmhKpe1 zAc2H@FN%QEbYD6VzK7PcU6JnF*qkJGlhl)ON{+!!~qw-%UijOABN-N%bg2s zRnWQ?3wYI~g|7@pBu#&?u41hg85)%v-oaLZJJ=zR*!~L7tnpQ9`ZH&ZeV}p z7M{C~4c)SH*mdwHw74B_rp}$&@6G&kulr|i;)7&*8v-m3v+O59asCkuV36N9hWKU; z^Sv5b4k?1YxJ;)dE$VV`YLUDEpUXv_Rs~+;ygVsyL~7#-N1EXK3r&7B_|g5R{Hz(Rs8pBclZI<(EKlg=_*_R literal 0 HcmV?d00001 diff --git a/out/production/FinalProject/edu/greenriver/sdev333/HashSet.class b/out/production/FinalProject/edu/greenriver/sdev333/HashSet.class new file mode 100644 index 0000000000000000000000000000000000000000..e4120395c28905e2a8455d46fd4b2a22e0c95ccb GIT binary patch literal 292 zcmaJ+yH3ME5S;ZR2FD~3AAq0(id^9`kOm1+SWpC|KijM1BFC1_kN=`VqTmDgs3?0; zYIddBomuVc@9^^r;2E_C3tB{CQLI^^LxL~*?#K066HE;3SF(WHIARfpxc_3 zaGU)YZ+HEvdNUN?6q;|`I0;*7-Q7r{$m>coNY@f-9df`?epl>r}P!Q_;O M60d|2CW0QON5e5bt^fc4 literal 0 HcmV?d00001 diff --git a/out/production/FinalProject/edu/greenriver/sdev333/MathSet.class b/out/production/FinalProject/edu/greenriver/sdev333/MathSet.class new file mode 100644 index 0000000000000000000000000000000000000000..b6d6603a0d19b469812aad23f7fe81264f5f1065 GIT binary patch literal 687 zcmah{O;5r=5S>M!fT;KZekCT}+6z5!v&g|j6C%a~#29Z&JK!QNWV>xrf0_q>fIrGO zEu;bb;Iw)BX5Z|*H=kec9{_L(rv_vgoS_%kLxm`n2vOO-hhd}9us@Ykk9P5EWu`7m>>p&rcve~=Es25E!p$hIqYA&Sz$Lpu% z7X%IAU%yUuL`_YLaMl-Zq)VX9AQwn6kqoZP&i{ir*17@)kLyI5=_swWdW*F*laLyf zPu?ZpEqP)vK!wt!NwO~(ksUSDT5z*X<-9*ehr#);#Ik<9IXC%YL1Pw{)B1VEpwyiN z%EcQojx(C4U60euGaz?qMF0vEeh%`44MLd&7on8mP2$V21@V$>!%lKmU^nIW=zf0% VAFSXi)YAGx>M`qd1jk9olW*pStgrw8 literal 0 HcmV?d00001 diff --git a/out/production/FinalProject/edu/greenriver/sdev333/Queue$LinkedListIterator.class b/out/production/FinalProject/edu/greenriver/sdev333/Queue$LinkedListIterator.class new file mode 100644 index 0000000000000000000000000000000000000000..e6bebdee34e47f0910f0c4c739f3373dce8380bc GIT binary patch literal 1322 zcmaJ=TTc^F5dKcPux;6vT5c+cAXR%&7O2-0hzSXiq}G@=eem*dXb)wfY{}WPM1PSl zK4=0l@xezQ{87d^yG@|h?8EMynKSdvd^2-?|M~F~z!sh-5kuUBVPOp847TX_c2^4F zO6N>S+v|w4N~L1I@r5t)HOD;`otopRJtZVpeaSGc4jnJQ#;{n6imj%QK+;6Y!UQaa z>=8fXc8|MV`}O{jXe&b6bX-SmGsFwURuUOZn#fwXh8)8}6gI=yfg?SFSc$A5U+;HB zRWqKpFr#73wlAe{RT6W!ZsLZ8o0w-;CGFc=-KI76=XFA+*Ghg%jFbppc`AC-wE zat!=@<@D^!<|P|W*X7EWf?6M0`(~4(PMV)iMRj{M;6Y^;B15Xh78S5VoEau*bfWH` z>Jn;x)Qo1Z*C1uTEVI z_Tnu=x}kXc_!U1L;7=Edqcb4l4)u#6b=fxtt5CeEZj8o-mZ2$Kt&qw|HTu46i(N-I zF%`UvRXtjUL|u65Wnb^1wdcA*?)13l3F>EVlo%DLr-&um#snB{lZ@%5r1LU8%^2=v zv-(ZaIZn0-tk6GCS}X7ba;5SGSm`^=Qu!R|3ru|reDBgfLovWRB=Mf!&j;Ki&7ydU z!hIA-7Kbb)(iqBkFv!s)slC&sb4>k$X?%te|3U@>8h$*uq2buop*Amc2Bf?5?4Ngxdy^8~Ib rUEb;3;oTbDg)LpD`oq%(Ds&&iBRmdd22V)lf}%2bN^*{x_zbbX*4!!J literal 0 HcmV?d00001 diff --git a/out/production/FinalProject/edu/greenriver/sdev333/Queue$Node.class b/out/production/FinalProject/edu/greenriver/sdev333/Queue$Node.class new file mode 100644 index 0000000000000000000000000000000000000000..8e49b37a6c8af1968a2ded784d5ff28e53d85619 GIT binary patch literal 673 zcmaJ z>QuT?Ak+I_*$_w!%$X%!&t?JIuB!9?J28g=TuIiCm1NZTfh#sQUH^;k=7I2&5QAkmhe6 znO~eur~UW9oM0x21I~wxI*cNmwd(a7MD-o9S4IkQ9HU&r430SJoBw0(37l-LWEm+q U5o$juq z(tpy2KJ(ItRwAubq`p?_Kj?o!6=!yr+KG{o<-PaLojG&P%wg{ zF_FcH!uS*C(6QT&w`V`td7^hig^^{~bHf#dbfvnTM-F)d1rwt%6=rm+Yw!75d%k<9 zeLHCB!&*$q`T-&4o5TDTHaaa`7vwP$rvx_Bc7jk0r%jab9u0x}Bk@$j zz!`~#@U#=t6FLf|=E*{kU>WC4T!;vI`iHPUf^#M= zVP3&-gSGvG@L5!)Zwy>ku!pj2y53XWYPvz#2(|Bo9lwADOd6;#c`tW#xznch{HD9- zIbql5-X5xGd5cl|Th9)3ePt=CEoH5;#tNsHR&R9oceKCdM6ji1XV+^@z04w7KbS%VeT-uLkoov92qqqNvpc}evJ8B90Mdp{@dT~PD zgXK5vxHXt|Wzf`TiBhpGClCvpovy#D@3}G;h3H*dl95pu-Oxd}uBE^1pV{y{?XR*p zf#xwIvmm2AFnXBdD5s$CKGIzIYI9%Z2O=V0Pto%kR{_Z~!?+;F z0%ByV4>>!4ES8w?HC$&|1nyrlOLM(PxZ=9?66HrM)Pz)shQ%XH$;yh&TEFAsPZ+c0 z%ql*|=+$^TYds>B%;Th>vC=CnqiD#I_-R~YNw2e+H&DS%TI&3*U=4R7z87N#314!- zCzzqgEXCen`BPERdtRa;_PY7MmyCl{ERWPH)C`o3WKKS%%Ppph<^If6DY`9^y72;2 zO_9URtjt9uqeU69)Lb+ui@(x6)-=tblDs+G=Wu+9Sv2@*{ECU1k&cNNI?<8iP{cZ9 zWO{ePKE4z7!Z`=^3RQ#A@n|p8ew+1)DX)>TG(7(j3(}h_La4v#U-vaVKhSisNXi)c j4yDAqyDYA}N1tPr>j-xXobfNXFL7TcskO+Kqu|tQd+T?_ literal 0 HcmV?d00001 diff --git a/out/production/FinalProject/edu/greenriver/sdev333/SeparateChainingHashTable.class b/out/production/FinalProject/edu/greenriver/sdev333/SeparateChainingHashTable.class new file mode 100644 index 0000000000000000000000000000000000000000..4bb5fbdf5741a40f04304b0f64818735b197ed85 GIT binary patch literal 3968 zcmc&%NmEo;6#i~^Lo+-O5O9DH(5TQ5P%vs3R3r|BK}{1PsELp6Cp>Msu?K_f)?tS;3>HE$(_rCt+ zp9c>C^kA+CF1Wq$Xvjmp!fqp&Xq${0MmTED8qu~`(3tJ$=xFmBGkR2y8+}u{88*X{ zC-m6Vh&~ZA6!N>d54; zf_$@vE!fJ?r-(kQOQ>V;GYL9dQ_g~3ub~0k6bi&(UnEF=h_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tW}wL{Pt3-4 zt5y9UuvhTAi#r^1m#wcXEtZY$(Hf%r9i{GzHEwoau5s%d`%T>AwU)=Yuo<_Hi*rAdWqlZz=5ed=PSu;4Cay^BKr zNq<2Usg;5RMQWrxCQ|-LANtVus<&^vi)}Ee+y~E`nLX#scfRk;`2F9%ya8|*U&atX zP(w&Z7-s~!H;f%4S23)$+{2X(S#|`@Oq-VJ%m@UNsii0)h-!%GI161MC0E_tnk}Ve zn>*6ZRafQC)YMe2B%iv{a!jLAl7?MgFD(j$zccMB^Gz1o4jNzBT9x@II?<(}TgOM} z5y<|(aN^#Sy8=ChlcnWV?R`4>5oeV|Y*eZO{mE9x)He#lIUVO!(IHDdb7I^WRHO|F zY$w|fIgefG$`}#|s^OB3%eW$-NsBtU z3_rE%C4p$kT(b@AL#VrS8{i8cU$IXvNa8fbBTISZ~y23z+(Fh{LQGEuwFu_qJQDL7T%Q<&!XOb&{tGL4SD&0Fq207nO??Wq2yv0Cf zVjmqpqxT1d_Gk_iU;Oi1`ZYS2(;4M+hzkeM(#!i84t;xoVFe*ngD?V(_Bf)rgg#!* ze%izQk|n5H1f!sh@~|+@;Tl1zs&D%smBp8l&=lN;mtw*5Qoud0DSBO}tt0p+!Wufe z{@}?TYd84qCO-9xd&yZ9H+EFqV57K*D)W_J;IHBp-Mlj51PCUHGEE testOne = new SeparateChainingHashTable<>(); + MathSet testOne = new SeparateChainingHashTables<>(); //scanner to add string to BSTSet @@ -25,7 +27,7 @@ public static void main(String[] args) { } //Test for MathSet - MathSet testTwo = new SeparateChainingHashTable<>(); + MathSet testTwo = new SeparateChainingHashTables<>(); testTwo.add("I"); testTwo.add("t"); testTwo.add("i"); diff --git a/src/edu/greenriver/sdev333/SeparateChainingHashTable.java b/src/edu/greenriver/sdev333/SeparatingChainHashTables.java similarity index 92% rename from src/edu/greenriver/sdev333/SeparateChainingHashTable.java rename to src/edu/greenriver/sdev333/SeparatingChainHashTables.java index 08484dd..c8caa59 100644 --- a/src/edu/greenriver/sdev333/SeparateChainingHashTable.java +++ b/src/edu/greenriver/sdev333/SeparatingChainHashTables.java @@ -1,27 +1,24 @@ package edu.greenriver.sdev333; /** - * Kevin Stone - * SDEV333: Final Project Part 1 - Implementing a Set - * * This class is to implement the MathSet interface. The * SequentialSearchST class (created in-class with instructor * Ken Hang) is used in this implementation. */ -public class SeparateChainingHashTable implements MathSet { +public class SeparateChainingHashTables implements MathSet { // fields: // array of linked lists - but we wrote a linked list in SequentialSearchSt private SequentialSearchST[] st; private int M; // M is the number of buckets // default constructor that calls our parameterized constructor - public SeparateChainingHashTable(){ + public SeparateChainingHashTables(){ // default constructor // calls the other constructor with a value this(997); } // constructor - public SeparateChainingHashTable(int M) { + public SeparateChainingHashTables(int M) { // take their number of buckets and save them into the field this.M = M; @@ -113,7 +110,7 @@ public int size() { @Override public MathSet union(MathSet other) { - MathSet result = new SeparateChainingHashTable(M); + MathSet result = new SeparateChainingHashTables(M); // add all current keys to resultSet for (KeyType currentKey: this.keys()) { @@ -138,7 +135,7 @@ public MathSet union(MathSet other) { @Override public MathSet intersection(MathSet other) { - MathSet result = new SeparateChainingHashTable(M); + MathSet result = new SeparateChainingHashTables(M); // if our current key is also in our "other" keys, add to resultSet for (KeyType currentKey: this.keys()) { @@ -161,7 +158,7 @@ public MathSet intersection(MathSet other) { @Override public MathSet difference(MathSet other) { - MathSet result = new SeparateChainingHashTable(M); + MathSet result = new SeparateChainingHashTables(M); // if our current key is not in our "other" keys, add to resultSet for (KeyType currentKey: this.keys()) { From 52586f6a610b4b19aa77533dd66de29222944071 Mon Sep 17 00:00:00 2001 From: sukanvisapearyoo Date: Mon, 20 Mar 2023 13:25:45 -0700 Subject: [PATCH 4/4] 5th commit/push --- out/production/FinalProject/Main.class | Bin 0 -> 2657 bytes .../edu/greenriver/sdev333/BSTset$Node.class | Bin 0 -> 840 bytes .../edu/greenriver/sdev333/BSTset.class | Bin 0 -> 4689 bytes .../sdev333/FlightRoutesGraph$Edge.class | Bin 0 -> 723 bytes .../greenriver/sdev333/FlightRoutesGraph.class | Bin 0 -> 3238 bytes .../edu/greenriver/sdev333/HashSet.class | Bin 0 -> 292 bytes .../edu/greenriver/sdev333/MathSet.class | Bin 0 -> 687 bytes .../sdev333/Queue$LinkedListIterator.class | Bin 0 -> 1322 bytes .../edu/greenriver/sdev333/Queue$Node.class | Bin 0 -> 673 bytes .../edu/greenriver/sdev333/Queue.class | Bin 0 -> 1943 bytes .../sdev333/SeparateChainingHashTable.class | Bin 0 -> 3968 bytes .../sdev333/SequentialSearchST$Node.class | Bin 0 -> 991 bytes .../greenriver/sdev333/SequentialSearchST.class | Bin 0 -> 2067 bytes src/Main.java | 10 ++++++---- ...Table.java => SeparatingChainHashTables.java} | 15 ++++++--------- 15 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 out/production/FinalProject/Main.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/BSTset$Node.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/BSTset.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/FlightRoutesGraph$Edge.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/FlightRoutesGraph.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/HashSet.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/MathSet.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/Queue$LinkedListIterator.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/Queue$Node.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/Queue.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/SeparateChainingHashTable.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/SequentialSearchST$Node.class create mode 100644 out/production/FinalProject/edu/greenriver/sdev333/SequentialSearchST.class rename src/edu/greenriver/sdev333/{SeparateChainingHashTable.java => SeparatingChainHashTables.java} (92%) diff --git a/out/production/FinalProject/Main.class b/out/production/FinalProject/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..e2ac6068cc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6Gz1;AG92fiOYP>t{^6^@;#eEx0vRG zb{oCodz=t=_*DIfK5>t4)dTcNMCI8Z;Oy?u#w1M#K6Gp?|R1 PH6PZQ^QVmV;In@Lt}|}_ literal 0 HcmV?d00001 diff --git a/out/production/FinalProject/edu/greenriver/sdev333/BSTset$Node.class b/out/production/FinalProject/edu/greenriver/sdev333/BSTset$Node.class new file mode 100644 index 0000000000000000000000000000000000000000..dfd2ae0af0581b24d347fd419bc5d25ac1c8d8aa GIT binary patch literal 840 zcmaJ<-*3`T6#i~0gR+h>hSRCIA2J0rs|inrxd%y%M1l_x-V0n=XV)&bg#`aAABc$$ z{sI0`#_yH|qcLsLo_^a((dXM0um;{NaO1h6 zKx_CxE{Dro*%mN;`H6*U=~9!<$ad0c7n{VF=Xw^5$SQAk#R9ME>7niax6*BlsIimG zb+_jQvOm8WOEuJe3Y2@{#Pvt6@-)74ntJ?tHh-P5+q?6f`bK4vy)X#pY9ilxI^*_w zljnM_0{Om-;`d<`=kQFRnz~H^yBh>jb$mC9Bn6my0yyR_^1Mq~T5b*k_lOJ}@V$=* z8+=Io@E^haS*P?Gc#2wL&+weK LK%EB8P>1mwpgywM literal 0 HcmV?d00001 diff --git a/out/production/FinalProject/edu/greenriver/sdev333/BSTset.class b/out/production/FinalProject/edu/greenriver/sdev333/BSTset.class new file mode 100644 index 0000000000000000000000000000000000000000..e539f752c048bfbd09fb802bfe5f77168fb0ec64 GIT binary patch literal 4689 zcmc&%-&0&?8GgRqvpKMPAP{I`()=I+3G9+UlUfanGzlS=mZgbMN@zuv-2;Ubi>B>7U?LCR(5Od}ntLmIWLyyx8-7 z=R5DO=lS0E{l5Lnzkc_70AI!HQG^gSVOWS@k3!S+^lG|yDeW%wK09~a&J-2)3^=Y+ z98?H*bx+o#4)rFY7Gkgzj@a2!??T?T-Mq7E=X(oTd-d$uv%MF`Cki%ojeIW0p<{Gg zxsI`1)=oxgy3xX3G|^Q$n^l{2ydil>n)1maeT?d6BfRVuPE%R!Yqp@)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c4B;5#1>obIjy`u6_{`pxY@|B9g32=3Pe{TqV* zEkWP?e}m@#Jdz+qdV|#?McQ&7DVE5yqvaFrigz054xo$m4@B}l|BL=HP^>NfM%A%c zUt-n=&oucao1(wn;Wy3t%XG;9KYjqeWB_s=w6RMVZ)LZ}n literal 0 HcmV?d00001 diff --git a/out/production/FinalProject/edu/greenriver/sdev333/FlightRoutesGraph$Edge.class b/out/production/FinalProject/edu/greenriver/sdev333/FlightRoutesGraph$Edge.class new file mode 100644 index 0000000000000000000000000000000000000000..f1a199e49cccb1e0d34e405b0aba49197054135c GIT binary patch literal 723 zcma)4OHbQC5dOwC6T^DF z?w>|7?CU?tK#TND1^4~R&t519v$`+S$|1pPO^a;gkwq?pyo))wgyL;54E!jFL;qLj zR&+IYJ(jW5Cj`5?+cq06xG11Vn2D2~_)aLbK0sGm$vAA7vXYCX_p&3x@9OkhO?I5j z?6wI`lUE=VS~3=wgS(DUe}hiMnNln122ndu(!~Fhj^T&kPrb*O*9MQdQOO;_(g`7d zl?+r@oJupMJaLKx!v!IGDN=o&q&kC5LUr165ZsG67OEKqX)1VE$6OYhOlOwAh|QL% zXU{U+0>z^FDI62a9F|$HaCFV@4%=mKZv^rlk@5CNnD=TUEIy3UW!9y)8sr$WfHHUd r!~&jX8!SF!m96o<@GNWWt+8jbtaD`HE542G2DaGddAfxSY{Pm5c(1E; literal 0 HcmV?d00001 diff --git a/out/production/FinalProject/edu/greenriver/sdev333/FlightRoutesGraph.class b/out/production/FinalProject/edu/greenriver/sdev333/FlightRoutesGraph.class new file mode 100644 index 0000000000000000000000000000000000000000..79a37fe844273915e5ea83a69e41d0a68c75bd09 GIT binary patch literal 3238 zcmbVOYf}?f7=8`}62giYBovB@iV6fx6|~mSS_vR%2x1U#wRK6BWFhS0?uJV3)!y&- zR)0aiwjD2{&UF0T-_uV{Z_n8c7=&o2voq)Vp69&pbDsB{{r&H|zX5n2*Mq1)r5`>8 zRj3xIpHUaoXkIn4(Xpu+E$s+Y_vwc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g|7@pBu#&?u41hg85)%v-oaLZJJ=zR*!~L7tnpQ9`ZH&ZeV}p z7M{C~4c)SH*mdwHw74B_rp}$&@6G&kulr|i;)7&*8v-m3v+O59asCkuV36N9hWKU; z^Sv5b4k?1YxJ;)dE$VV`YLUDEpUXv_Rs~+;ygVsyL~7#-N1EXK3r&7B_|g5R{Hz(Rs8pBclZI<(EKlg=_*_R literal 0 HcmV?d00001 diff --git a/out/production/FinalProject/edu/greenriver/sdev333/HashSet.class b/out/production/FinalProject/edu/greenriver/sdev333/HashSet.class new file mode 100644 index 0000000000000000000000000000000000000000..e4120395c28905e2a8455d46fd4b2a22e0c95ccb GIT binary patch literal 292 zcmaJ+yH3ME5S;ZR2FD~3AAq0(id^9`kOm1+SWpC|KijM1BFC1_kN=`VqTmDgs3?0; zYIddBomuVc@9^^r;2E_C3tB{CQLI^^LxL~*?#K066HE;3SF(WHIARfpxc_3 zaGU)YZ+HEvdNUN?6q;|`I0;*7-Q7r{$m>coNY@f-9df`?epl>r}P!Q_;O M60d|2CW0QON5e5bt^fc4 literal 0 HcmV?d00001 diff --git a/out/production/FinalProject/edu/greenriver/sdev333/MathSet.class b/out/production/FinalProject/edu/greenriver/sdev333/MathSet.class new file mode 100644 index 0000000000000000000000000000000000000000..b6d6603a0d19b469812aad23f7fe81264f5f1065 GIT binary patch literal 687 zcmah{O;5r=5S>M!fT;KZekCT}+6z5!v&g|j6C%a~#29Z&JK!QNWV>xrf0_q>fIrGO zEu;bb;Iw)BX5Z|*H=kec9{_L(rv_vgoS_%kLxm`n2vOO-hhd}9us@Ykk9P5EWu`7m>>p&rcve~=Es25E!p$hIqYA&Sz$Lpu% z7X%IAU%yUuL`_YLaMl-Zq)VX9AQwn6kqoZP&i{ir*17@)kLyI5=_swWdW*F*laLyf zPu?ZpEqP)vK!wt!NwO~(ksUSDT5z*X<-9*ehr#);#Ik<9IXC%YL1Pw{)B1VEpwyiN z%EcQojx(C4U60euGaz?qMF0vEeh%`44MLd&7on8mP2$V21@V$>!%lKmU^nIW=zf0% VAFSXi)YAGx>M`qd1jk9olW*pStgrw8 literal 0 HcmV?d00001 diff --git a/out/production/FinalProject/edu/greenriver/sdev333/Queue$LinkedListIterator.class b/out/production/FinalProject/edu/greenriver/sdev333/Queue$LinkedListIterator.class new file mode 100644 index 0000000000000000000000000000000000000000..e6bebdee34e47f0910f0c4c739f3373dce8380bc GIT binary patch literal 1322 zcmaJ=TTc^F5dKcPux;6vT5c+cAXR%&7O2-0hzSXiq}G@=eem*dXb)wfY{}WPM1PSl zK4=0l@xezQ{87d^yG@|h?8EMynKSdvd^2-?|M~F~z!sh-5kuUBVPOp847TX_c2^4F zO6N>S+v|w4N~L1I@r5t)HOD;`otopRJtZVpeaSGc4jnJQ#;{n6imj%QK+;6Y!UQaa z>=8fXc8|MV`}O{jXe&b6bX-SmGsFwURuUOZn#fwXh8)8}6gI=yfg?SFSc$A5U+;HB zRWqKpFr#73wlAe{RT6W!ZsLZ8o0w-;CGFc=-KI76=XFA+*Ghg%jFbppc`AC-wE zat!=@<@D^!<|P|W*X7EWf?6M0`(~4(PMV)iMRj{M;6Y^;B15Xh78S5VoEau*bfWH` z>Jn;x)Qo1Z*C1uTEVI z_Tnu=x}kXc_!U1L;7=Edqcb4l4)u#6b=fxtt5CeEZj8o-mZ2$Kt&qw|HTu46i(N-I zF%`UvRXtjUL|u65Wnb^1wdcA*?)13l3F>EVlo%DLr-&um#snB{lZ@%5r1LU8%^2=v zv-(ZaIZn0-tk6GCS}X7ba;5SGSm`^=Qu!R|3ru|reDBgfLovWRB=Mf!&j;Ki&7ydU z!hIA-7Kbb)(iqBkFv!s)slC&sb4>k$X?%te|3U@>8h$*uq2buop*Amc2Bf?5?4Ngxdy^8~Ib rUEb;3;oTbDg)LpD`oq%(Ds&&iBRmdd22V)lf}%2bN^*{x_zbbX*4!!J literal 0 HcmV?d00001 diff --git a/out/production/FinalProject/edu/greenriver/sdev333/Queue$Node.class b/out/production/FinalProject/edu/greenriver/sdev333/Queue$Node.class new file mode 100644 index 0000000000000000000000000000000000000000..8e49b37a6c8af1968a2ded784d5ff28e53d85619 GIT binary patch literal 673 zcmaJ z>QuT?Ak+I_*$_w!%$X%!&t?JIuB!9?J28g=TuIiCm1NZTfh#sQUH^;k=7I2&5QAkmhe6 znO~eur~UW9oM0x21I~wxI*cNmwd(a7MD-o9S4IkQ9HU&r430SJoBw0(37l-LWEm+q U5o$juq z(tpy2KJ(ItRwAubq`p?_Kj?o!6=!yr+KG{o<-PaLojG&P%wg{ zF_FcH!uS*C(6QT&w`V`td7^hig^^{~bHf#dbfvnTM-F)d1rwt%6=rm+Yw!75d%k<9 zeLHCB!&*$q`T-&4o5TDTHaaa`7vwP$rvx_Bc7jk0r%jab9u0x}Bk@$j zz!`~#@U#=t6FLf|=E*{kU>WC4T!;vI`iHPUf^#M= zVP3&-gSGvG@L5!)Zwy>ku!pj2y53XWYPvz#2(|Bo9lwADOd6;#c`tW#xznch{HD9- zIbql5-X5xGd5cl|Th9)3ePt=CEoH5;#tNsHR&R9oceKCdM6ji1XV+^@z04w7KbS%VeT-uLkoov92qqqNvpc}evJ8B90Mdp{@dT~PD zgXK5vxHXt|Wzf`TiBhpGClCvpovy#D@3}G;h3H*dl95pu-Oxd}uBE^1pV{y{?XR*p zf#xwIvmm2AFnXBdD5s$CKGIzIYI9%Z2O=V0Pto%kR{_Z~!?+;F z0%ByV4>>!4ES8w?HC$&|1nyrlOLM(PxZ=9?66HrM)Pz)shQ%XH$;yh&TEFAsPZ+c0 z%ql*|=+$^TYds>B%;Th>vC=CnqiD#I_-R~YNw2e+H&DS%TI&3*U=4R7z87N#314!- zCzzqgEXCen`BPERdtRa;_PY7MmyCl{ERWPH)C`o3WKKS%%Ppph<^If6DY`9^y72;2 zO_9URtjt9uqeU69)Lb+ui@(x6)-=tblDs+G=Wu+9Sv2@*{ECU1k&cNNI?<8iP{cZ9 zWO{ePKE4z7!Z`=^3RQ#A@n|p8ew+1)DX)>TG(7(j3(}h_La4v#U-vaVKhSisNXi)c j4yDAqyDYA}N1tPr>j-xXobfNXFL7TcskO+Kqu|tQd+T?_ literal 0 HcmV?d00001 diff --git a/out/production/FinalProject/edu/greenriver/sdev333/SeparateChainingHashTable.class b/out/production/FinalProject/edu/greenriver/sdev333/SeparateChainingHashTable.class new file mode 100644 index 0000000000000000000000000000000000000000..4bb5fbdf5741a40f04304b0f64818735b197ed85 GIT binary patch literal 3968 zcmc&%NmEo;6#i~^Lo+-O5O9DH(5TQ5P%vs3R3r|BK}{1PsELp6Cp>Msu?K_f)?tS;3>HE$(_rCt+ zp9c>C^kA+CF1Wq$Xvjmp!fqp&Xq${0MmTED8qu~`(3tJ$=xFmBGkR2y8+}u{88*X{ zC-m6Vh&~ZA6!N>d54; zf_$@vE!fJ?r-(kQOQ>V;GYL9dQ_g~3ub~0k6bi&(UnEF=h_~PU z@yg1IINYIOCw6gh(x9E4Yx!Fpf&{Qbw0#gxyx6PZHSANUNCQoZFltkzuMuVmCYa7b zzd0G!|#`H}e9h7;2hM%3x1ior-g4~^DCg+cG{5D@yP=xTV|}=X^_s< z<#TZLQm*ivq-NVL@<$TUfN{)}3#%^YW!5T(A`fsEFEJJlN0(eNoWI4}(gi<%yt6ph zxW)^P&k??z;JV^i;463kc^B$?&fR#MPdT4K8(vx&<5=xvzNt`a(bxnlb@MxxE!=7OCZAsX0cIk(N0q@0&H z&eJYs&vq$$X_phU!pp~TX*w=T1^X*M!|Pdq$1OhXwAem-Gklh&e3q{ADSNh0*%O~a ze;!=g;UwY!7x_uyxQ}pLi~7dzQmE~cJWg8s*QGu9oU|JZ;v%~Fl>Coy6lP0&i)gx$ zg95+h-0p`Y?dg6%#u@>#FU)`)xg-q z+qosU#w0i%2}9)K)%)0^Fw9}U!dIx~q(`CC)3U{LAH6Otto+q{AIB8dmur!H+7-2p z#|aQ8s;ex6IerVy^Hc8woWzHW^&>`m%|f}CG3}zP$)@sfH#w7*PPW`RT*75y(QpbO z&Ro_3kk-7A(v+F4Y1gM{PNy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tl1zs&D%smBp8l&=lN;mtw*5Qoud0DSBO}tt0p+!Wufe z{@}?TYd84qCO-9xd&yZ9H+EFqV57K*D)W_J;IHBp-Mlj51PCUHGEE testOne = new SeparateChainingHashTable<>(); + MathSet testOne = new SeparateChainingHashTables<>(); //scanner to add string to BSTSet @@ -25,7 +27,7 @@ public static void main(String[] args) { } //Test for MathSet - MathSet testTwo = new SeparateChainingHashTable<>(); + MathSet testTwo = new SeparateChainingHashTables<>(); testTwo.add("I"); testTwo.add("t"); testTwo.add("i"); diff --git a/src/edu/greenriver/sdev333/SeparateChainingHashTable.java b/src/edu/greenriver/sdev333/SeparatingChainHashTables.java similarity index 92% rename from src/edu/greenriver/sdev333/SeparateChainingHashTable.java rename to src/edu/greenriver/sdev333/SeparatingChainHashTables.java index 08484dd..c8caa59 100644 --- a/src/edu/greenriver/sdev333/SeparateChainingHashTable.java +++ b/src/edu/greenriver/sdev333/SeparatingChainHashTables.java @@ -1,27 +1,24 @@ package edu.greenriver.sdev333; /** - * Kevin Stone - * SDEV333: Final Project Part 1 - Implementing a Set - * * This class is to implement the MathSet interface. The * SequentialSearchST class (created in-class with instructor * Ken Hang) is used in this implementation. */ -public class SeparateChainingHashTable implements MathSet { +public class SeparateChainingHashTables implements MathSet { // fields: // array of linked lists - but we wrote a linked list in SequentialSearchSt private SequentialSearchST[] st; private int M; // M is the number of buckets // default constructor that calls our parameterized constructor - public SeparateChainingHashTable(){ + public SeparateChainingHashTables(){ // default constructor // calls the other constructor with a value this(997); } // constructor - public SeparateChainingHashTable(int M) { + public SeparateChainingHashTables(int M) { // take their number of buckets and save them into the field this.M = M; @@ -113,7 +110,7 @@ public int size() { @Override public MathSet union(MathSet other) { - MathSet result = new SeparateChainingHashTable(M); + MathSet result = new SeparateChainingHashTables(M); // add all current keys to resultSet for (KeyType currentKey: this.keys()) { @@ -138,7 +135,7 @@ public MathSet union(MathSet other) { @Override public MathSet intersection(MathSet other) { - MathSet result = new SeparateChainingHashTable(M); + MathSet result = new SeparateChainingHashTables(M); // if our current key is also in our "other" keys, add to resultSet for (KeyType currentKey: this.keys()) { @@ -161,7 +158,7 @@ public MathSet intersection(MathSet other) { @Override public MathSet difference(MathSet other) { - MathSet result = new SeparateChainingHashTable(M); + MathSet result = new SeparateChainingHashTables(M); // if our current key is not in our "other" keys, add to resultSet for (KeyType currentKey: this.keys()) {