Posts

Showing posts with the label Learning

Sorting Algorithms

Image
A Sorting Algorithm is used to rearrange a given array or list elements according to a comparison operator on the elements. The comparison operator is used to decide the new order of elements in the respective data structure. The most frequently used orders are numerical order and lexicographical order (also known as lexical order, dictionary order, alphabetical order or lexicographic(al) product). Efficient sorting is important for optimizing the efficiency of other algorithms (such as search and merge algorithms) which require input data to be in sorted lists. Sorting is also often useful for canonicalizing data and for producing human-readable output. More formally, the output of any sorting algorithm must satisfy two conditions: The output is in nondecreasing order (each element is no smaller than the previous element according to the desired total order); The output is a permutation (a reordering, yet retaining all of the original elements) of the input. Exa...

Binary Search

Image
Binary search  is the most popular Search algorithm. It is efficient and also one of the most commonly used techniques that are used to solve problems. If all the names in the world are written down together in order and you want to search for the position of a specific name, binary search will accomplish this in a maximum of  35  iterations. Binary search works only on a sorted set of elements. To use binary search on a collection, the collection must first be sorted. When the binary search is used to perform operations on a sorted set, the number of iterations can always be reduced on the basis of the value that is being searched. Let us consider the following array: By using a linear search, the position of element 8 will be determined in the  9 t h  iteration. Let's see how the number of iterations can be reduced by using a binary search. Before we start the search, we need to know the start and end of the range. Let's call them...

Linear Search

Image
Linear search is used on a collection of items. It relies on the technique of traversing a list from start to end by exploring properties of all the elements that are found on the way. For example, consider an array of integers of size  N . You should find and print the position of all the elements with value  x . Here, the linear search is based on the idea of matching each element from the beginning of the list to the end of the list with the integer  x , and then printing the position of the element if the condition is `True'. Implementation: for ( start to end of array ) { if ( current_element equals to 5 ) { print ( current_index ); } }

Why “To learn coding skills” should be your new year resolution for 2018?

Image
The year 2017 is coming to the end and now probably  you  might  have started making a list of your new year resolutions for the year of 2018. Yes, I am pretty sure that many items from your list are exactly same as my list. (Image source: Internet ) But this is the time to add a new item to your list and that is " To learn coding skills". Why should you learn to code? Have you ever noticed how you spent this year? Posting photos on Instagram, sharing thoughts over the Facebook, tweeting around the Tweeter, watching funny videos on YouTube, swiping left on tinder, Snapchatting, WhatsApp, Pinterest, LinkedIn, Reddit, Vine, Tumblr, blogging, vlogging, online shopping and many more. In short, the most of the time of 2017 we spent over the Internet, but have you ever felt curious about how these things actually work? Most of the stuff is accessible for free. How they earn money from providing these stuff for free? If you buy/search some product on...