Linked lists are not suitable data structures for which one of the following problems?
View worked solution
Answer: B
The correct option is B: Binary search.
Here is a detailed explanation of why linked lists are unsuitable for binary search, while being highly suitable for the other options:
- Binary Search (Option B): Binary search relies on the ability to access the middle element of any subsegment in time (random access). In a linked list, accessing the -th element requires traversing from the head, taking time. Consequently, performing a binary search on a linked list of size takes time, which defeats the purpose of the algorithm.
- Insertion Sort (Option A): Insertion sort can be efficiently implemented on linked lists. Once the insertion position is found, inserting a node requires only pointer updates, without needing to shift subsequent elements (unlike in an array).
- Radix Sort (Option C): Radix sort distributes elements into buckets. Linked lists are ideal for representing these buckets because they can grow dynamically, avoiding the overhead of pre-allocating fixed-size arrays for each bucket.
- Polynomial Manipulation (Option D): Polynomials are standard applications of linked lists. Each term of the polynomial (coefficient and exponent) is represented as a node. This allows easy addition, subtraction, and multiplication by dynamically traversing and merging the lists.
Free practice · Your answers on this page are not saved.
