Posts

Showing posts with the label sorting algorithm

Study of Algorithm and its analysis

Image
In the world of computer science, every on heard of the term Algorithm. Now it's the time to know in-depth about it and also study to how to start writing an algorithm before actual coding. Writing an algorithm for a solution is 80% of the coding done. An algorithm is named for the ninth century Persian mathematician al-Khowarizmi, that is it is a set of rules used to compute some calculations. For any computer problems after understanding the problem, writing an algorithm is the second step. Once you have the algorithm ready now you can write code in any programming language you want. The famous algorithm, Euclid's algorithm for getting the greatest common divisor of two numbers is been written in ancient Greek.  Algorithm:  "An algorithm is defined as a set of unambiguous rules written in a specific sequence to produce expected output for predefined inputs." Let's come out of this bookies definition, and understand the steps for solving a problem in the ...

Radix Sort the best sorting algorithm

Image
Hi, this is Shubham Mishra, I write blogs on algorithms and on the technologies. Today we will be going to deals with one of the best algorithm for sorting of an array. Before doing this algorithm I recommend you to visit other algorithms such as  Merge Sort , so as to compare Radix sort algorithm with them. Radix sort is my favourite for its time complexity. Don't panic about time complexity for Radix, I will cover that later in this post. Radix sort is also known as bucket sort. The radix sort is to sort decimal numbers, where the radix or base is 10, which need 10 buckets. This all buckets are numbered from 0 to 9. The most important part of the algorithm is that the number of iterations required is equal to the number of digits in the largest number in the list. For example, refer to the table below, Radix Sort Algorithm Before moving on to the algorithm and code I would like to explain you in general terms that how radix sort works.  The number o...

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...