Question: 1. public class IntSet 2. private Vector els; 3. //constructor 5. public IntSetO 6. els = new Vector(); 8. 9. public void insert(int x) 10.

 1. public class IntSet 2. private Vector els; 3. //constructor 5.
public IntSetO 6. els = new Vector(); 8. 9. public void insert(int

1. public class IntSet 2. private Vector els; 3. //constructor 5. public IntSetO 6. els = new Vector(); 8. 9. public void insert(int x) 10. I/Modifies: this 11. I/Effects: Adds x to the elements of this 12. 13. 14. public void remove(int x) 15. I/Modifies: this 16. l/Effects: removes x from this 17.3 18. public boolean isIn(int x)t 19. 20. 21. ircerer s If i in h ers take 22. private getIndex(Integer x) 23. 24.3 25 26. public int sizeO 27. I/Effects: returns the cardinality of this 28.) 29. 30. public int choose0 throws EmptyExcpetionf //Effects: if x is in this returns index where x appears else //returns-1 //Effects: if this is empty throws EmptyException else //returns an arbitrary element of this 32. 33. ) 34

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!