Code Pumpkin

Category Archives: Algorithms

Trapping Rain Water | Algorithm Problem

October 29, 2017
Posted by Dipen Adroja

In this article, we are going to solve the trapping water problem. This kind of problems are asked very frequently in interviews and online programming challenges. Problem Statement We need to find the maximum volume of water that can be stored in between buildings or bars as shown in the below image. Assume that width of each […]

Merge Sort | Sorting Algorithm

October 15, 2017
Posted by Dipen Adroja

Merge Sort is a Divide and Conquer algorithm. Divide and conquer algorithms divide the original data into smaller sets of data to solve the problem. During the Mergesort process, the elements of the array or collections are divided into two parts. To split an array, Mergesort will take the middle element of the array and split the […]

Bubble Sort | Sorting Algorithm

October 15, 2017
Posted by Dipen Adroja

In Bubble sort, each element is compared with its adjacent element. If the first element is smaller than the second one, then the positions of the elements are interchanged, otherwise it is not changed. Then next element is compared with its adjacent element and the same process is repeated for all the elements in the array […]

Selection Sort | Algorithms

October 8, 2017
Posted by Dipen Adroja

In our previous articles, we have seen two of the searching algorithms like Binary Search and Fibonacci Search alogorithm. In this article, we will go through Selection Sort algorithm. Selection sort is one of the simplest sorting algorithm available. Before going into more details we will see first see why sorting is required in programming. Sorting […]

Fibonacci search

October 8, 2017
Posted by Dipen Adroja

In this article, we will see one more searching algorithm Fibonacci search. This searching algorithm has some similarity with Binary Search that we have seen in our last article. Both of them works on sorted arrays. Fibonacci Search is a comparison-based technique that uses Fibonacci numbers to search an element in a sorted array. Fibonacci Search Definition […]

Binary Search

October 8, 2017
Posted by Dipen Adroja

There are many ways to search for the element from the given sorted array of n elements. Linear search, binary search, Fibonacci Search are few of them. In this article, we will see the binary search in detail. Binary search enables searching of the element in O(log n) time complexity. Binary Search (definition) Search a sorted […]

N Queen Problem Using Recursive Backtracking

April 1, 2017
Posted by Abhi Andhariya

N Queen Problem is the problem of placing N chess queens on an NxN chessboard so that no two queens attack each other, for which solutions exist for all natural numbers n except n=2 and n=3. A solution requires that no two queens share the same row, column, or diagonal. It is more general form of inital Eight queens problem, where we need to […]

Graph Search – Depth First Search

April 1, 2017
Posted by Dipen Adroja

We discussed about basic search mechanisms for Graph and Breadth First Search(BFS) in previous article. In this article we will start with basic definition of the Depth First Search(DFS). Depth First Search(DFS): In depth first search, we start from the root node then traverse the graph layerwise until we reach the leaf or dead end. In short, One […]

Graph Search – Breadth First Search

April 1, 2017
Posted by Dipen Adroja

In Our previous article about Graph, we have seen the different ways to represent the graph.  we have a way to represent this unstructured data structure.  Now question arise is how I will traverse through this given graph structure.  There are main two methods which we will use to traverse through graph.  Breadth First Search […]

Sudoku Solver using Recursive Backtracking

March 31, 2017
Posted by Abhi Andhariya

Sudoku  is a logic-based combinatorial number-placement puzzle. Given a partially filled 9×9 2D array grid[9][9], the goal is to assign digits (from 1 to 9) to the empty cells so that every row, column, and subgrid of size 3×3 contains exactly one instance of the digits from 1 to 9. For Detailed understanding about Sudoku, […]

Total Posts : 124
follow us in feedly

Like Us On Facebook