Apple Interview Question for Staff Engineers

Country: United States

Comment hidden because of low score. Click to expand.
of 1 vote

Linked list is used in the case where you care about fast insertions and lookups are not performed that often. Due to insertions being constant time, the linked list does not need to resize as necessary but instead just append the node at the end or beginning of the linked list. This makes them a very flexible data structure.

On the other hand, an array is used when lookup via indexing is performed often. In this case, lookups give constant time but the downside is resizing or inserting elements into the array. Another advantage of arrays is that arrays offer is binary search for lookups in the case where the array is sorted. Unfortunately, with linked lists binary search can not be used.

- prudent_programmer March 17, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
of 0 vote

- LinkedList is the best choice when your frequent operation is insertion or deletion of an element from the middle.
- LinkedList is the worst choice when your frequent operation is retrieval of objects from the list.

- ArrayList is the best choice if our frequent operation is Retrieval
- ArrayList is the worst choice if our frequent operation is insertion and deletion of element from the middle.

- Charankumar. H July 27, 2018 | Flag Reply

Add a Comment

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.


is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More


CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More