Sudhir sharma has Published 1206 Articles

Print all increasing sequences of length k from first n natural numbers in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 11:31:31

389 Views

In this problem, we are given two integers K and n. Our task is to print all increasing sequences of length K using first n natural numbers.The increasing sequence is a sequence of numbers in which the value of the next element is greater than the previous one.Let’s take an ... Read More

Print all integers that are sum of powers of two given numbers in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 11:28:46

146 Views

In this problem, we are given two numbers a and b and an integer bound and we have to print all values less than binding which is the sum of squares of a and b.Bound >= ai + bjLet’s take an example to understand the problem −Input: a=2, b=3, bound=8 ... Read More

Print all interleavings of given two strings in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 11:25:19

373 Views

In this problem, we are given two string str1 and str2 and we have to print all interleaving strings from both the string.Interleaving string created using two given strings such that the order of characters of each string.Let’s take an example to understand the problem −Input: str1 = “XY” str2= ... Read More

Print all internal nodes of a Binary tree in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 11:22:32

1K+ Views

In this problem, we are given a binary tree and we have to print all internal nodes of the binary tree.The binary tree is a tree in which a node can have a maximum of 2 child nodes. Node or vertex can have no nodes, one child or two child ... Read More

Print all Jumping Numbers smaller than or equal to a given value in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 11:18:45

751 Views

In this problem, we are given a number n and we have to print all jumping numbers that are smaller than or equal to n.Jumping Numbers are the number whose adjacent digits differ by one only. Some jumping numbers are 4565, 98, 7. All single-digit numbers are considered as jumping ... Read More

Print all k-sum paths in a binary tree in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 11:16:03

381 Views

In this problem, we are given a binary tree and a number K and we have to print all paths in the tree which have the sum of nodes in the path equal k.Here, the path of the tree can start from any node of the tree and end at ... Read More

Print All Leaf Nodes of a Binary Tree from left to right using Iterative Approach in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 11:11:47

222 Views

In this problem, we are given a binary tree and we have to print all leaf nodes of the binary tree from left to right the iterative approach.Let’s take an example to understand the problemInput −Output − 1 4 7To solve this problem using the iterative approach, we will use ... Read More

Print all leaf nodes of a binary tree from right to left in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 11:04:51

486 Views

In this problem, we are given a binary tree and we have to print all leaf nodes of the binary tree from right to left.Let’s take an example to understand the problemInput −Output − 7 4 1To solve this problem, we will have to traverse the binary tree. This traversal ... Read More

Print all leaf nodes of an n-ary tree using DFS in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 10:59:00

446 Views

In this problem, we are given a 2-D array containing the edge of an n-ary where edge defines the edge of the n-ary tree. We have to print all the leaf nodes of the created a-ary tree.The n-ary tree is a tree with has maximum n children i.e. a node ... Read More

Print all multiplicative primes <= N in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 10:55:19

60 Views

In this problem, we are given an integer n and we have to print all multiplicative primes less than or equal to n.Multiplicative primes are prime numbers that have a product of their digits also prime numbers. Like 2, 3, 5, 7, 13, 17.23 is prime but not a multiplicative ... Read More

Advertisements