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:
https://www.youtube.com/watch?v=OPK0fV8-XL8

Interview: Find Occurances in an Array – Binary Search Application

Some theory:
https://www.youtube.com/watch?v=OE7wUUpJw6I

https://www.youtube.com/watch?v=pLT_9jwaPLs
code:

Optimized Code: Using Binary Search

 

 

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