Category Archives: Ds/Algos

interview questions based on data structures and algotrithms

Find if 2 Rectangles overlap

Given two rectangles with their base parallel to each other . You have to find whether the rectangles overlap or not. Ex Rect1(2,3,5,6) Rect2(1,3,1,10) Where a rectangle is specified by coordinates of it’s TopLeft (x1,y1) and BottomMRight(x2,y2) coordinates in sequence for rect1 TopLeft(2,3) and BottomRight(5,6). The problem is very simple . Since the rectangle have… Read More »

Linked list creation and manipulation

Here’s the code to create a linked list. And perform various operations on it. U can use this code for reference . The code is self explanatory.

Merge Sort Code

Merge Sort belongs to category of divide and conquer algorithms. Which means it divides the problem into  small subproblems, solves them and then combine the solutions of these subproblems to generate solution  of the original problem.Merge Sort compares elements with each other for sorting the list. The steps followed to mergesort are are: Divide the unsorted list… Read More »

Quick Sort Code

Quick Sort belongs to the category ofdivide and conquer algorithms. Quicksort  divides a large list into two smaller lists around a selected pivot . Quicksort can then recursively sort the sub-lists.It sorts the elements inplace. The steps followed are are: Select an element, called a pivot, from the list. Reorder the list so that all elements with values… Read More »