Using Java Please Identify which structures you would select

Using Java Please

Identify which structures you would select based on the given requirements and why. (There may be more than 1 answer, justification counts the most). Data access requires a lot of random access, no particular order. Data amounts are unknown and will vary greatly, no particular order. Specific data elements will be changed (added/deleted) often.

Solution

Please find the answers below:

Data access requires a lot of random access, no particular order :

I would reccomend an Array in the case if you requires a lot of random access. Arrays will provide an O(1) complexity for accessing its elements at any position irrespective of its size. Thus a lot of acess will not make much of performance impact.

Data amounts are unknown and will vary greatly, no particular order :

I would recommand a List data structure in the case if you requires a data structure with unkown size. The list will provide flexibility in changing size depending on the situation. It can grows as well as shrinks based on the scenraios.

Specifc data elements will be changed (added/deleted) often :

I would recommand a Map like data structure in the scenario where if you requires more often data modification. The Map will provide an O(1) for accessing its elements.Thus makes it simple to access its data elements easily so that it can be modified.

Using Java Please Identify which structures you would select based on the given requirements and why. (There may be more than 1 answer, justification counts the

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site