Binary Search
Floor Function
- floor(x): If
xis a real number, thenfloor(x)is the greatest integer less than or equal to x.
Ceil Function
- ceil(x): If
xis a real number, thenceil(x)is the smallest integer greater than or equal to x.
Binary Search Recursive Equation
- Finding the middle element:
- Comparing the key with the middle element:
- If
key == arr[mid]→ element found - If
key < arr[mid]→ search in left half - If
key > arr[mid]→ search in right half
- If
Recursive Equation
- id
- = Time to comparing key with mid
- $t\left(\frac{2}\right)$ = Time to search in the remaining half the array
- $dbyin
Recurrence Relation
- Def a mapping from natural numme set.
A recurrence relation defines each term of tuence as a function of itsibonacci Relation
This is a classic recurrence relation.
General Form of Recurrence Relation
Let Is a sequence where an is term of the sequence then a relation of type
- is some functi, \dots, c_k$ are coner, called the degree ofinear recurrance relation with constant coefficient.
condition
Types of Recurrence Relations
- Homogeneous Linear Recurrence Relation with constant coefficient
- Inhomogeneous Linear Recurrence Relation with constant coefficient
Examples of Recurrence Relation
| Homogeneous | |
| Inhomogeneous | |
| Inhomogeneous |

