Ternary Search
Ternary search is a divide and conquer algorithm that can be used to find an element in an array. It is similar to binary search where we divide the array into two parts but in this algorithm, we divide the given array into three parts and determine which has the key (searched element). This algorithm also has the constraint that the array must be sorted. The time complexity for this algorithm is O(log 3 N) where ‘N’ is the size of the array.
Searching in Array
Searching is one of the most common operations performed in an array. Array searching can be defined as the operation of finding a particular element or a group of elements in the array.
There are several searching algorithms. The most commonly used among them are:
- Linear Search
- Binary Search
- Ternary Search