Algorithm Technical Interview Questions
An algorithm is a set of rules or a process that must be followed. Algorithms are commonly used in a variety of fields, from information technology, to mathematics and statistics, etc. In terms of computers or software, the algorithm is a structured procedure that allows a computer to solve a problem. The algorithm works are a set of guidelines or steps that the computer must solve in chronological order in order to arrive at the solution. The purpose of the algorithm is to provide the computer, or rather the software, a set of instructions to follow, which must be complete till the end, and in the order provided. For example:
This is a simple but very vague example of an algorithm. 
Binary search is also commonly known as halfinterval search or logarithmic search. It is a type of search algorithm that can be used to find the position of a target value within a sorted array. The way binary search works is that it compares the target value to the middle element of the array. If the values are unequal, then the half in which the target value cannot exist is eliminated and is not searched. Binary Search then continues to search he remaining half in the same way until the target value is found. Binary search runs in at worst logarithmic time, making O(log n) comparisons. It can also be said that O(log n) is the time complexity of Binary Search. At a glance the complexity table is like this 

Binary search is a type of search that can be used to find a target value within a sorted array. In a linked list, random access is typically not allows, which makes it difficult to reach the middle element in O(1) time. As Binary Search searches in O(1) time, it cannot be used for linked lists. However, there are other ways to search a linked list, such as linear search. 
There are times when one may find themselves faced with two rectangles and be left wondering whether or not they are overlapping. In order to find out whether or not the two given rectangles overlap, the first step is to identify the rectangles. To do so, is to identify the coordinates of the rectangles. For this purpose, letâ€™s consider them to be:
Then, lets write a function that would return true if the two given rectangles overlap: bool doOverlap(l1, r1, l2, r2) The function should return true of one of the following conditions are met:
The function should return false for one of the following conditions:

One of the common problems one might face is to find the angle between the hour and minute hands at a given time. The easiest way to do this is this:

QuickSort is a type of Divide and Conquer algorithm. It works by picking an element as pivot. It then partitions the given array around the picked pivot. There are many different versions of quicksort. Then differ in the way they pick pivot. QuickSort will pivot if four different ways:
Regardless of what it pick, the key element in QuickSort is partition(). The target of partitions is to put x at its correct position in a sorted array and put all the elements smaller than x before x, and put all elements greater than x after x, after it has been given an array and an element x of array as pivot. Now there are times, when QuickSort might fail. Some of the worst cases of Quicksort might occur in following cases:

Add new comment