Sudhir sharma has Published 1149 Articles

Print all nodes at distance k from a given node in C++

sudhir sharma

sudhir sharma

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

478 Views

In this problem, we are given a binary tree, a target node and an integer K. We have to print all the nodes of the tree that are at a distance K from the target node.Binary Tree is a special tree whose each node has at max two nodes (one/two/none).Let’s ... Read More

Print all nodes between two given levels in Binary Tree in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 10:23:32

220 Views

In this problem, we are given a binary tree and two levels in the tree (upper and lower) and we have to print all nodes between upper and lower levels of the tree.The binary tree is a special tree whose each node has at max two nodes (one/two/none).Let’s take an ... Read More

Print all nodes in a binary tree having K leaves in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 10:17:13

185 Views

In this problem, we are given a binary tree and an integer K and we have to print all nodes of the binary tree that have K leaves in their child subtree.The binary tree is a special tree whose each node has at max two nodes (one/two/none).The leaf node of ... Read More

Print all nodes less than a value x in a Min Heap in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 10:13:49

260 Views

In this problem, we are given a Min Heap and a value x and we have to print all nodes less than x.Min heap is a special type of binary tree in which every node has a value less than the node value of its child node.Let’s take an example ... Read More

Print all nodes that are at distance k from a leaf node in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 10:06:10

215 Views

In this problem, we are given a binary tree and a number K. We have to print all nodes of the tree that are at k distance from the leaf node.Binary Tree is a special tree whose each node has at max two nodes (one/two/none).The leaf node of a binary ... Read More

Print all numbers less than N with at-most 2 unique digits in C++

sudhir sharma

sudhir sharma

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

172 Views

In this problem, we are given an integer N and we have printed all the number less than N with at-most 2 unique digits i.e. maximum 2 different digits can be used to create the number.Let’s take an example to understand the problem −Input: N = 17 Output: 1 2 ... Read More

Print all numbers whose set of prime factors is a subset of the set of the prime factors of X in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 09:55:23

206 Views

In this problem, we are given a set of N numbers and a number X. And we have to print all numbers from the array whose set of prime factors is a subset of the set of prime factors of X.Let’s take an example to understand the problemInput: X= 30 ... Read More

Print all odd numbers and their sum from 1 to n in PL/SQL

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 09:46:19

3K+ Views

In this problem, we are given a number n and we have to print all odd numbers from 1 to n and also print the sum of numbers from 1 to n in PL/SQL.PL/SQL is a procedural language extension to SQL. The code is a sequence of instructions that are ... Read More

Print all pairs in an unsorted array with equal sum in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 09:42:05

314 Views

In this problem, we have an unsorted array and we have to print all pairs within this array that have an equal sum.Let’s take an example to understand the problem −Input: array = [12, 13, 20, 5] Output: [12, 13] and [20, 5] have sum 25.To solve this problem, we ... Read More

Print all pairs of anagrams in a given array of strings in C++

sudhir sharma

sudhir sharma

Updated on 22-Jan-2020 09:37:31

463 Views

In this problem, we are given an array of strings and we have to print all pairs of anagrams of that given array.Anagrams are strings that are formed by rearranging the character of another string. Like − hello and lolheLet’s take an example to understand the problem −Input: array = ... Read More

Advertisements