Binary search is a simple search technique that works on sorted array, either it can be ascending or descending. Below are the steps to perform binary search: Binary search can be similar to searching a word in a dictionary. We open the book in the middle …
Definition: Linear search is a search algorithm, that checks for the key in a set of values one by one till it reaches the end of all the elements. For example: consider the array , and we need to search for the number 48. Below are …
Shell sort is also called as Diminishing increment sort, Comb sort, Gap sort invented by Donald L. Shell. In this algorithm is based on comparison, but instead of comparing and swapping adjacent elements, it compares the elements that are having certain gap present between them. Hence …
Radix sort algorithm is an interesting sorting algorithm. Because this sort is not based on comparison, rather than it is based on buckets. Radix Sort is a linear sort algorithm. The number of passes depends upon the number of digits in the maximum number in the …
Introduction: This is a very simple algorithm that works if there are only 3 different types of keys in an array. For example: If we have an un-sorted array of 0, 1, 2 as shown {2, 0, 0, 1, 1, 2, 0, 2, 1}, easy solution …