Assume you need keep track of 100 000 elements the order mat

Assume you need keep track of 100 000 elements (the order matters) New elements are rarely added, but you constantly need to read and overwrite existing elements. What should you use? Linked List Array List Neither use a HashTable Either array list or linked list it doesn\'t matter

Solution

ArrayList is a preferred choice. The reason behind this is that, a Linked list stores elements, but the efficiency to read elements is not as simple as that of linked list, or hashtable. There are no index values for linked list, therefore accessing an element requires linear time where as, in arraylist, accessing an element takes a constant time. Therefore, it is adviced to used ArrayList as opposed to that of linkedlist, or hashtable.

 Assume you need keep track of 100 000 elements (the order matters) New elements are rarely added, but you constantly need to read and overwrite existing elemen

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site