Basic mode of searching is looping the collection from first to last index of array. While looping, conditional statement being performed to find the matched item in array.

Watch the patterns:

  • If we have 4 items in array, it performs max 4 times of searching.
  • If we have 8 items in array, it performs max 8 times of searching.
  • If we have 10 items in array, it performs between 10 times of searching.

Therefore, the complexity of Basic Search is O(N).

Go try to code!

results matching ""

    No results matching ""