Category Archives: Binary Search

Interview: Find Occurances in an Array – Binary Search Application

Some theory:


code:

Optimized Code: Using Binary Search

 

 

Algorithm: Binary Search

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)


recursive code:

Algo Pseudo Code:

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