## Inorder Tree Traversal without Recursion

Using Stack is the obvious way to traverse tree without recursion. Below is an algorithm for traversing binary tree using stack. See this for step… Read More »

## C# Program for Maximum size square sub-matrix with all 1s

Given a binary matrix, find out the maximum size square sub-matrix with all 1s. For example, consider the below binary matrix. Recommended: Please solve it… Read More »

## Python Program for Maximum size square sub-matrix with all 1s

Given a binary matrix, find out the maximum size square sub-matrix with all 1s. For example, consider the below binary matrix. Recommended: Please solve it… Read More »

## Java Program for Maximum size square sub-matrix with all 1s

Given a binary matrix, find out the maximum size square sub-matrix with all 1s. For example, consider the below binary matrix. Recommended: Please solve it… Read More »

## C Program for Maximum size square sub-matrix with all 1s

Given a binary matrix, find out the maximum size square sub-matrix with all 1s. For example, consider the below binary matrix. Recommended: Please solve it… Read More »

## Maximum size square sub-matrix with all 1s

Given a binary matrix, find out the maximum size square sub-matrix with all 1s. For example, consider the below binary matrix. Recommended: Please solve it… Read More »

## Print list items containing all characters of a given word

There is a list of items. Given a specific word, e.g., “sun”, print out all the items in list which contain all the characters of… Read More »

## Data Structures and Algorithms | Set 22

Following questions have been asked in GATE CS 2005 exam. 1) A program P reads in 500 integers in the range [0..100] representing the scores… Read More »

## Data Structures and Algorithms | Set 21

Following questions have been asked in GATE CS 2008 exam. 1. The subset-sum problem is defined as follows. Given a set of n positive integers,… Read More »

## Split a Circular Linked List into two halves

Original Linked List Result Linked List 1 Result Linked List 2 If there are odd number of nodes, then first list should contain one extra.… Read More »

## Data Structures and Algorithms | Set 20

Following questions have asked in GATE CS 2006 exam. 1. Let S be an NP-complete problem and Q and R be two other problems not… Read More »

## Find whether a given number is a power of 4 or not

Given an integer n, find whether it is a power of 4 or not. Example : Input : 16 Output : 16 is a power… Read More »

## Reverse a Doubly Linked List

Write a C function to reverse a given Doubly Linked List See below diagrams for example. (a) Original Doubly Linked List (b) Reversed Doubly Linked… Read More »

## Data Structures and Algorithms | Set 19

Following questions have been asked in GATE CS 2009 exam. 1. Let X be a problem that belongs to the class NP. Then which one… Read More »

## How to determine if a binary tree is height-balanced?

A tree where no leaf is much farther away from the root than any other leaf. Different balancing schemes allow different definitions of “much farther”… Read More »