Posts

Showing posts with the label Divide and Conquer technique

Divide and Conquer an Algorithm design technique

Image
Hey, this is  Shubham Mishra . In our previous post of  Algorithm and its analysis , we have discussed all the algorithm, its designing and many another part. In the same post, In the algorithm designing section, I have mentioned a step that is 'Algorithm Strategy' for selecting a technique to design an algorithm. Out of all the, one very most popular among all is Divide and Conquer. Now, let's start with divide and conquer technique for algorithm designing. In this technique, a problem is, Broken down into smaller sub-problems. The sub-problems are solved independently. Merge all the solutions of all sub-problems to get the solution to the original problem. Basically, If a problem seems too big but if the problem needs repetitive steps then it's better to divide the big problem and solve sub-problems. The sub-problems once solved then combine the solutions of sub-problems to get the result for the original problem. Now let's understand it with the ...

Naive String Matching Algorithm

Image
Hi, this is Shubham Mishra. I write blogs on algorithms and new technologies. In today's blog, we will be going to see a traditional way for string matching. For this blog, I have taken the reference of Analysis of Algorithm by A.A.Putambekar's book. String matching generally used in text processing. Normally text processing is done in the compilation of a program. The string matching is a vital part in software designing and system designing. String matching means finding one or more generally all the occurrences of a string in a text. These occurrences are called Pattern . Let, Text T is denoted by T0.....T(n-1) and pattern P is denoted by P0....P(m-1). String Matching Algorithm For String matching scenario we will be discussing many algorithms in upcoming blogs such as, The naive method (This blog) Rabin-Karp algorithm Finite automaton for string matching Knuth - Morris - Pratt method Naive String Matching Algorithm Naiv...

Merge Sort: What is Merge sort and Its complexity

Image
Hi, this is Shubham Mishra, today we will be going to discuss on a topic which deals with the sorting of an array. In my algorithm series, this is the first post but previously I also have written other posts such as  Python game develop using Pygames  and  Data structure and data structure types . The today's topic is Merge sort algorithm. In the series of the algorithm, we will discuss all the possible kind of algorithms and also its complexity with the condition for the use of such algorithms. Let's discuss Merge sort algorithm, its time complexity. Merge sort is a very efficient sorting algorithm with the near-optimal number of comparisons. It is best described using a Recursive algorithm approach . The working of merge sorting algorithm is to splitting and merging of two sorted lists into one sorted list. The recursive algorithm used for merge sort comes under the category of divide and conquer technique. An array of n elements is split around its c...