Binary search is the most popular and efficient searching algorithm having an average time complexity of O(log N). Like linear search, we use it to find a particular item in the list.

Binary search works only on a sorted set of elements. To use binary search on a collection, the collection must first be sorted.

Binary Search

What is binary search?

The first half…

Arrays in real life

What are arrays?

Arrays are a collection of individual values separated by a comma each with its own index/location. This collection could be anything: numbers, objects, more arrays, etc. In an array, the values, called elements, are stored in contiguous memory locations.

This means that all the elements are all in a sequence and they share a common border. The number of elements store in an array is referred to as the array’s length.

An array is one of the most efficient ways to store and access a sequence of values or store a collection of data with similar elements. …

Vikash Kumar

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store