# Category Archives: Algorithms

Given an array of n positive integers. Write a program to find the sum of maximum sum subsequence of the given array such that the… Read More
Given a rod of length n inches and an array of prices that includes prices of all pieces of size smaller than n. Determine… Read More
Given a sequence, find the length of the longest palindromic subsequence in it.  As another example, if the given sequence is “BBABCBCAB”, then the… Read More
Hamiltonian cycle: The Hamiltonian cycle of undirected graph          G <= V , E> is the cycle containing each vertex in V.… Read More
In the previous post, we discussed the Finite Automata-based pattern searching algorithm. The FA (Finite Automata) construction method discussed in the previous post takes O((m^3)*NO_OF_CHARS)… Read More
Given an undirected graph and a number m, determine if the graph can be colored with at most m colors such that no two adjacent… Read More
Given a number x and two positions (from the right side) in the binary representation of x, write a function that swaps n bits at… Read More
Given a text txt[0..n-1] and a pattern pat[0..m-1], write a function search(char pat[], char txt[]) that prints all occurrences of pat[] in txt[]. You may… Read More
The following is a description of the instance of this famous puzzle involving N = 2 eggs and a building with K = 36 floors.Suppose… Read More
Given two Linked Lists, create union and intersection lists that contain union and intersection of the elements present in the given lists. The order of… Read More
Greedy is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece that offers the most obvious and immediate… Read More
What is the 0/1 Knapsack Problem? We are given N items where each item has some weight and profit associated with it. We are also… Read More
Write a function Add() that returns sum of two integers. The function should not use any of the arithmetic operators (+, ++, –, -, ..… Read More
In the previous post, we discussed how Asymptotic analysis overcomes the problems of the naive way of analyzing algorithms. But let’s take an overview of… Read More
The following are the common definitions of Binomial Coefficients.  A binomial coefficient C(n, k) can be defined as the coefficient of x^k in the expansion… Read More