A program must repeatedly insert new records at the FRONT of a collection that already holds thousands of records, and the position of existing records never needs to be looked up by index. For this workload, why is a singly linked list a better choice than an array?
Insertion at the front of a linked list only relinks a couple of pointers, while an array must shift every existing element one place to make room
A linked list stores its elements in contiguous memory, which makes front insertion faster than in an array
A linked list allows any element to be read directly by its index, which an array cannot do
A linked list keeps its elements automatically sorted, so new records always land in the right place
The verified answer and full solution are one login away
Every answer here is machine verified, with a step-by-step solution that teaches the method. Your login also unlocks a 7-question mock preview in the real exam interface.
Log in to see the answerMore data structures questions