1.

Array is preferred over linked list for the implementation of ________(a) Radix sort(b) Insertion sort(c) Binary search(d) Polynomial evaluationThe question was posed to me in an online quiz.My question is based upon Static vs Dynamic Memory Allocation in chapter Dynamic Memory Allocation in C of C

Answer»

The correct ANSWER is (c) Binary search

The explanation is: When we try to IMPLEMENT binary search using linked list, the traversal steps per ELEMENT increases in order to find the middle element. Thus, this process is slow and inefficient. This process is much faster using an array, hence it is preferable to use an array for the IMPLEMENTATION of binary search.



Discussion

No Comment Found

Related InterviewSolutions