Sudhir sharma has Published 1206 Articles

Print all the cycles in an undirected graph in C++

sudhir sharma

sudhir sharma

Updated on 17-Jan-2020 10:11:49

2K+ Views

In this problem, we are given an undirected graph and we have to print all the cycles that are formed in the graph.Undirected Graph is a graph that is connected together. All the edges of the unidirectional graph are bidirectional. It is also known as an undirected network.Cycle in a ... Read More

Print all the levels with odd and even number of nodes in it in C++

sudhir sharma

sudhir sharma

Updated on 17-Jan-2020 10:09:56

128 Views

In this problem, we are given a tree. And we have to print all the levels with even number of nodes and odd number of nodes in it.Let’s take an example to understand the concept betterOutput −Levels with odd number of nodes: 1, 3, 4 Levels with even number of ... Read More

Print all the duplicates in the input string in C++

sudhir sharma

sudhir sharma

Updated on 17-Jan-2020 10:05:08

335 Views

In this problem, we are given a string and we have to find all the characters that are duplicated along with their number of occurrences in the string.Let’s take an example to understand the problem −Input: TutorialsPoint Output: t (3) o (2) i (2)Explanation− The frequencies of occurrence of each ... Read More

Print all the pairs that contains the positive and negative values of an element in C++

sudhir sharma

sudhir sharma

Updated on 17-Jan-2020 09:58:19

122 Views

In this problem, we are given an array of unique integers. And we have to return all pairs of integers(positive and negative integers) that are present in the array.Let’s take an example to understand the problem better −Input: array = {1 , 4 , 7 , -1, 2, 5, -7} ... Read More

Print all the palindromic permutations of given string in alphabetic order in C++

sudhir sharma

sudhir sharma

Updated on 17-Jan-2020 09:57:09

193 Views

In this problem, we are given a string of size n. And we have to print all possible palindromic permutation that can be generated using the characters of the string in alphabetical order. If palindrome is not created using the string print ‘-1’.Let’s take an example to understand the topic ... Read More

Print all the paths from root, with a specified sum in Binary tree in C++

sudhir sharma

sudhir sharma

Updated on 17-Jan-2020 09:53:32

139 Views

In this problem, we are given a Binary tree and a sum S. And we have to find the path starting from root to any node of the tree, which gives the sum equal to the given sum.InputSum = 14 Output : path : 4 10 4 3 7To find ... Read More

Print all triplets with given sum in C++

sudhir sharma

sudhir sharma

Updated on 17-Jan-2020 09:48:03

191 Views

In this problem, we are given an array of unique integers and a sum. And we have to find the triplets which can form the same sum.Let's take an example to solve the problem −Input : array = {0 , 2 , -1 , 1, -2} Sum = 1 Output ... Read More

Print all the sum pairs which occur maximum number of times in C++

sudhir sharma

sudhir sharma

Updated on 17-Jan-2020 09:42:13

96 Views

In this problem, we are given an array of n unique integers. And we have to find the sum of two integers of the array which has the maximum frequency. The problem has multiple solutions and you need to find them all.Input : array = { 1, 12, 5, 7, ... Read More

Print all triplets in sorted array that form AP in C++

sudhir sharma

sudhir sharma

Updated on 17-Jan-2020 09:39:52

155 Views

In this problem, we are given a sorted array of numbers and we need to find the triplets with are in the form of arithmetic progression.An arithmetic progression is a series of numbers in which the difference between consecutive terms is the same.Let’s take an example to understand the problem ... Read More

Print all paths from a given source to a destination in C++

sudhir sharma

sudhir sharma

Updated on 16-Jan-2020 12:44:35

272 Views

In this problem we are given a directed graph and we have to print all paths from the source to the destination of the graph.Directed graph is a graph in with edges that are directed from vertex a to b.Let’s take an example to understand the problem Source = K destination ... Read More

Advertisements