Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Which of the JCF interfaces would be the most useful if we want to store a co

ID: 3593932 • Letter: 1

Question

1. Which of the JCF interfaces would be the most useful if we want to store a collection of students enrolled in COMP2102 so that we can quickly check if a student is enrolled in COMP24027 (a) Collection (b) Set (c) SortedSet (d) Hap (e) SortedMap 2. What if we also want to be able to quickly output a list of students, sorted by (lastname, firatnano)7 (a) Collection (b) Set c) SortedSet (d) Map (c) SortedMap 3. What if, in addition, we also want to store some auxiliary information (e.g., a mark) with each student? (a) Collection (b) Set (c) SortedSet (d) Hap o) sortedMap

Explanation / Answer

1) Ans. b. Set (Set talkes O(1) time to check whether an element is present in or not)

2) Ans. c. SortedSet

3) Ans. e. SortedMap

SortedMap<Student, double>