Category Archives: Searching

Algo: Linear Search

code:

Another Code By Me:

Complexity:
Best Case: O(1)
Worst Case: O(n)
Average Case: O(n/2)=O(n)
Source: http://quiz.geeksforgeeks.org/linear-search/

Pseudocode Looks Like this:

source: http://clrs.skanev.com/02/01/03.html

Another Good Pseudocode:

Source:

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