FANDOM


Lists are linear data structures (one-dimensional collection), for example, an array. Searching in a list involves finding if an element exists in the list or not.

Major topics Edit

  • Linear Search: Checking each element one-by-one if it is the element to be found. This does not need the list to be sorted. It searches any list, runs in O(n). Typically a search like this would use a loop to iterate through the list until the required item was found.
  • Binary Search: Dividing the list into two parts and determining which part the element is in by checking some property. Typically done by sorting the list and checking for the equality of the middle element.
  • Ternary Search: Similar to binary search but the list is divided into 3 parts each time and the part where the element is likely to be is determined.
  • N-ary Search: This is an extension of binary and ternary search algorithms. Here the list is divided into n distinct sub-lists and the list which is most likely to contain the element is determined and searched.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.