Skip to the content.

Algorithm Cheatsheet

Searching Algorithms

The basic idea behind this algorithm is to add a sentinel value at the end of the array which is equal to the target value we are looking for. This helps to avoid checking the array boundary condition during each iteration of the loop, as the sentinel value acts as a stopper for the loop.