Assume that the numList has seven elements [8, -4, 7, 17, 0, 2, 19]
If the list is not sorted and used as it is, then which among the following is the best suitable search technique to search any element?
Assume that the numList has seven elements [8, -4, 7, 17, 0, 2, 19]
If the list is not sorted and used as it is, then which among the following is the best suitable search technique to search any element?
Solution
Linear search checks elements one by one from the start, so it works on any list as it is, sorted or not. For an unsorted list of seven elements, it is the simplest and most suitable technique.
Option 1: Binary search only works on a sorted list, because it relies on comparing with the middle element to discard half the list.
Option 2: Hashing needs a hash table built beforehand, so it is not applied directly to a plain list.
Option 4: Bubble sort is a sorting technique; "bubble search" is not a standard search method.
Related questions:
2026: 23 May Shift 1
2026: 20 May Shift 1
2026: 31 May Shift 1
2026: 20 May Shift 1
2026: 23 May Shift 1