Skip to content

Given a sorted array of size N and an integer K, find the position(0-based indexing) at which K is present in the array using binary search.

Notifications You must be signed in to change notification settings

agrimaswal/binarysearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

binarysearch

Given a sorted array of size N and an integer K, find the position(0-based indexing) at which K is present in the array using binary search.

Example 1:

Input:
N = 5
arr[] = {1 2 3 4 5} 
K = 4
Output: 3
Explanation: 4 appears at index 3.
Example 2:

Input:
N = 5
arr[] = {11 22 33 44 55} 
K = 445
Output: -1
Explanation: 445 is not present.

About

Given a sorted array of size N and an integer K, find the position(0-based indexing) at which K is present in the array using binary search.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages