Skip to content

Arifulislam5577/Data-Structures-and-Algorithms

Repository files navigation

#Data Structure & Algorithm

####What is Binary Search? Binary Search is a searching algorithm used in a sorted array by repeatedly dividing the search interval in half. The idea of binary search is to use the information that the array is sorted and reduce the time complexity to O(Log n).

####Algorithm Terms

  • Array Should be sorted by default
  • Example: const arr = [1, 2, 3, 4, 5]
  • Need to specify first element index
  • Need to specify last element index
  • Need to specify middle element index
  • Example: let leftIndex = 0; let rightIndex = arr.length - 1 let middleIndex = parseInt((leftIndex + rightIndex)/2)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published