Open harshraj8843 opened 10 months ago
👋🏻 Hey @harshraj8843
💖 Thanks for opening this issue 💖
A team member should be by to give feedback soon.
!assign
!assign
Hey @AMiracle-creator, this issue is already assigned to @AmeyaK17! cc/ @codinasion/codinasion
Description
Write a Swift program to implement binary search
Binary search is a fast search algorithm with run-time complexity of Ο(log n). This search algorithm works on the principle of divide and conquer. For this algorithm to work properly, the data collection should be in the sorted form.
Binary search looks for a particular item by comparing the middle most item of the collection. If a match occurs, then the index of item is returned. If the middle item is greater than the item, then the item is searched in the sub-array to the left of the middle item. Otherwise, the item is searched for in the sub-array to the right of the middle item. This process continues on the sub-array as well until the size of the subarray reduces to zero.
Pseudocode
Example
How to contribute
- Comment `!assign` to assign this issue to yourself - Fork this repository - Create a new branch - Save the solution in `program/program/implement-binary-search/ImplementBinarySearch.swift` - Commit the changes - Create a pull request