Greedy Algorithm

Greedy Algorithm Greedy is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece that offers the most obvious and immediate benefit. At every step, we can make a choice that looks best at the moment, and we get the optimal solution of the complete problem. If a Greedy... Continue Reading →

Advertisements

Asymptotic Analysis

Evaluate performance of algorithm in term of input size Order of growth in performance in respective of no of elements. Cases to analyze algorithm Worst Case : upper bound O(n) Average Case Best Case: lower bound O(1)  Notations: Theta Notation Θ: Bound algo from above & below Big O Notation : defines Upper bound Omega... Continue Reading →

Searching

Searching: Linear Search Sequential search value in array | O(n) Binary Search Sequential Searching sorted array Find middle element if required element is more than middle then go to right arr and so on. O(nlogn) Jump Search Jump fixed no of steps If required no is less than new step ele do linear search from... Continue Reading →

Sorting

Sorting: Selection Sort Finding minimum element from unsorted part and putting at beginning Algo maintain two subarray One which is sorted and Other remaining which are not sorted Complexity O(n2) Bubble Sort Repeatedly swapping adjacent elements if they are in wrong order Complexity O(n2) Insertion Sort Putting element at correct location Done as we do... Continue Reading →

Create a website or blog at WordPress.com

Up ↑