Algorithm: Binary Search

https://www.youtube.com/watch?v=j5uXyPJ0Pew&vl=en

https://www.youtube.com/watch?v=OAZc1zwjERU

iterative code:

//mathay rakhte hobe function e loop statement e auto return korey while condition er baire gele return korbe -1.. -1 eta return kortese amader nijeder kollane jate index e ei return value niye kaaj korano jay pore

Worst Case: O(logn)

https://www.youtube.com/watch?v=-bQ4UzUmWe8
recursive code:

Algo Pseudo Code:

Source: http://www.studytonight.com/data-structures/search-algorithms

 

Spread the love