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

Data Structures class question, please help! Part II TRUE or FALSE. If the state

ID: 3821282 • Letter: D

Question

Data Structures class question, please help!

Part II TRUE or FALSE. If the statement is false, then correct it to make it true. In the following, assume that you are storing employee records which are ordered by last name of the employee. You want to use a data structure from the JAVA COLLECTIONS LIBRARY to store this records. A TreeMap data structure will store records in-order. A HashMap data structure will store records in-order. A HashSet data structure will store records in order. A TreeMap data structure should be able to retrieve a record faster than a HashMap data structure. A TreeSet data structure will not allow duplicate records.

Explanation / Answer

1. TreeMap Data structure will store records in order : TRUE ,no need any modification

Explanation : It stores values based key and it stores unique key. It maintains ascending order.

2. A hashmap data structure will store records in order : False , Need Modification

Modified Statement : A HashMap data structure maintains no order.

3. A HashSet data structure stores records in order : False ,Need Modification

Explanation : A HashSet is implemented by using hash table and it maintains no order.

4. TreeMap Data Structure should be able to retrieve records faster than HashMap data Structure: False

Modified Statement : HashMap Data Structure should be able to retrieve records faster than TreeMap data Strcture

HashMap is faster then Treemap. HashMap O(1) for access and TreeMap O(logn) for acess.

5. A TreeSet data structure will not allow duplicate record : TRUE

Explanation: TreeSet implements set interface and does not allow duplicate element.