Showing posts with label Divide And Conquer Strategy. Show all posts
Showing posts with label Divide And Conquer Strategy. Show all posts

Analysis Design of Algorithm (ADA) | Divide And Conquer Strategy Introduction

📌Highlights: Hi friends! In this I am going to explain about Divide and Conquer Strategy.


Divide and conquer strategy simply says that if any problem is big and easy to solve than that problem is divided into sub problems , process it and get solution, But if the sub problem is also big and not easy to solve than sub problem is divided sub sub problems if it will not solve than do the same thing again on that sub sub problem until we are not getting solution.

ANALYSIS DESIGN OF ALGORITHM | BINARY SEARCH

 

📌Highlights: Hi Friends ! In this post I am going to explain the concept of Binary Search , How this will work, How to write Binary Search Algorithm, How to write the procedure of Binary Search in C.How to find their complexity and example. 


Binary Search method is based on divide and conquer strategy. In Binary search first we find mid position element of array and point it to the (MID) index pointer. Now we compare searching element (S) to MID element. Such that 


If MID position element is greater than (S) then we discard second part of array and continue binary search with first part from (LOW) to (MID-1).


If MID position is less than (S) then we discard first part of array and continue Binary Search with second part from (MID+1) to (HIGH).

ANALYSIS DESIGN OF ALGORITHM (ADA) | MERGE SORT

📌Highlight: Hi Friends ! In this post I am going to explain about the concept of merge sort ,Also discuss about their algorithm and function with some example.


Merge sort is based on divide and conquer strategy in which first we try to divide array of N elements to N - sorted array of single elements then merging process merge these sorted array into one sorted array.


Let we understand by the help of an example:


Suppose we have an array of 8 elements such as:



Now we want to sort these elements using merge sort.