26.2k views
5 votes
Suppose you need to organize a collection of telephone numbers for a company division. There are currently about 6,000 employees, and you know that the phone switch can handle at most 10,000 phone numbers. You expect several hundred lookups against the collection every day. Would you use an array list or a linked list to store the information

User Mausworks
by
4.6k points

2 Answers

5 votes

Answer:

I would use an array list over a linked list to store the given information from the question.

Step-by-step explanation:

Let us define what an array list and linked list are

Array list: Array List and Linked List both maintains insertion order and implements List interface. Array List basically uses a dynamic array to keep or store the elements.

Linked list: Linked List internally uses a list that is doubly linked to keep or store the elements

Now,

Using an array list will be of advantage than a linked list as far as look ups are concerned. also we do have some idea about the size of information,

while a Linked list will be useful when we don't know the size of data. also retrieving the information from the array list is much more simpler than linked list as random access is possible with arrays against sequential traversal for lists.

User Thedarkpassenger
by
4.8k points
0 votes

Answer:

Using an array list is preferable

Step-by-step explanation:

A Linked List is an arranged collection of information of the same type in which each element is connected to the next using pointers.

An array list contains set of similar data objects stored in a well arranged memory locations under a common heading or a variable name.

Array elements can be accessed randomly using the array index and can be looked up anytime which makes it correct.Random accessing is not possible in linked list.

User Andersonvom
by
4.6k points