Arnab Chakraborty has Published 4293 Articles

Check if a given tree graph is linear or not in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Oct-2019 08:26:43

191 Views

Here we will see how to check whether a tree graph is linear or not. A linear tree graph can be expressed in one line, suppose this is an example of a linear tree graph.But this is not linear −To check a graph is linear or not, we can follow ... Read More

Check if a given string is sum-string in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Oct-2019 08:21:51

362 Views

Here we will see how to check whether a string is sum-string or not. A string is said to be sum-string if the rightmost substring can be written as the sum of two substrings before it, and the same is recursively true for substring before it. Suppose a string like ... Read More

Check if a given directed graph is strongly connected in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Oct-2019 08:16:56

402 Views

Suppose we have a graph. We have to check whether the graph is strongly connected or not. A graph is said to be strongly connected, if any two vertices have a path between them, then the graph is connected. An undirected graph is strongly connected graph. Some undirected graph may ... Read More

Check if a given circle lies completely inside the ring formed by two concentric circles in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Oct-2019 08:12:55

979 Views

We have two circles. The center of both of them is at the origin. The radius of these two circles is given. They are r and R, R > r. Another circle is also present. Its radius (r1) and the center point are given, we have to check whether that ... Read More

Check if a given Binary Tree is SumTree in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Oct-2019 08:05:45

225 Views

Here we will see how to check whether a binary tree is sum-tree or not. Now the question is what is the sum-tree. A sum-tree is a binary tree where a node will hold the sum value of its children. The root of the tree will contain an entire sum ... Read More

Check if a given array contains duplicate elements within k distance from each in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Oct-2019 08:02:29

443 Views

Here we will see how to check whether an unsorted array has duplicate elements within k distance from each other or not. Suppose a list of elements is {1, 2, 3, 1, 4, 5}, here if k = 3, then the program will return true, as the distance between two ... Read More

Check if a doubly linked list of characters is palindrome or not in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Oct-2019 07:54:29

718 Views

Here we will see how to check a string is a palindrome or not using a Doubly linked list. Here we will push each character of a string inside one doubly linked list. There will be two pointers, left and right. Then start scanning from both sides. If a left ... Read More

Check if a binary tree is subtree of another binary tree in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Oct-2019 07:52:12

779 Views

Suppose we have two binary trees. We have to check whether the smaller tree is a subtree of another binary tree or not. Consider these two trees are given.There are two trees. The second tree is the subtree of the first one. To check this property, we will traverse the ... Read More

Check if a binary tree is sorted level-wise or not in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Oct-2019 07:49:00

152 Views

Here we will see how to check a binary tree is level wise sorted or not. The level wise sorted binary tree will be look like below −In each level, the nodes are sorted from left to right, and each layer contains higher value than its previous level.We can solve ... Read More

Check horizontal and vertical symmetry in binary matrix in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Oct-2019 07:46:03

274 Views

Suppose we have a binary matrix of order M x N. The task is to check whether the matrix is horizontally symmetric, vertically symmetric or both. One matrix is said to be horizontally symmetric if the ith row is the same as the (M – i)th row, this is said ... Read More

Advertisements