Home Practice Programming

# Practice Programming

### Inorder Successor of a Node in Binary Search Tree

Given a pointer to a node of a Binary Search Tree(BST), we have to find the next node, which is the Inorder...

### Design an algorithm to create a linked list of all the nodes at each depth

Given a binary tree, we have to design an algorithm that will create a linked list of all the nodes at each...

### Insert M into N such that M starts at bit j and ends at bit i

Given two 32-bit numbers, Nand M, and two-bit positions, i and j. Write a method to insert Minto N such that M...

### Print all possible combinations of balanced valid parenthesis

We have to write an algorithm to print all possible combinations of the balanced valid parenthesis for n pairs of parenthesis. A...

### Print all unique permutations of a string with duplicate characters

A permutation is an act of rearranging or reordering elements of a set or string uniquely etc.For n elements, n! (n factorial) permutations are...

### Print all permutations of a string with unique characters

A permutation is an act of rearranging or reordering elements of a set or string etc. For n elements, n! (n factorial) permutations are possible. Ex->...

### Find all possible subset of a given set

Given a set (of n elements), Print all possible subset (2^n) of this set. Example: Set = {a,b,c}, Power set of S, P(S) = {Φ,...

### Find if a path is possible for reaching bottom right from the top left in a nxm grid

A robot sitting on the upper left corner(0,0) of a grid with r rows and c columns. The robot can only move in two directions:...

### Count number of ways to reach the nth stair by climbing 1, 2 or 3 steps

A child is running up a staircase with n steps and can hop either 1 step, 2 steps, or 3 steps at a time. Implement...

### Algorithm to create linked list of nodes at each depth in Binary tree

Here we are given a binary tree, and we have to design an algorithm from scratch, which will create a linked list of all...