Sunidhi Bansal has Published 1085 Articles

Count of Palindromic substrings in an Index range in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 29-Jan-2021 07:49:16

284 Views

We are given a string and a range starting from start till end and the task is to calculate the count of palindromic substring present in a given range. Palindrome strings are those strings which are similar from forward and backward of a string like nitin, aba, etc.For ExampleInput - InputString ... Read More

Count the Number of Binary Search Trees present in a Binary Tree in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 07-Jan-2021 07:03:44

1K+ Views

We are given a binary tree as input. The goal is to find the number of binary search trees (BSTs) present as subtrees inside it. A BST is a binary tree with left child less than root and right child more than the root.For ExampleInputThe tree which will be created ... Read More

Construct Special Binary Tree from given Inorder traversal in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 07-Jan-2021 06:59:43

470 Views

We are given an array arr[] containing the inorder traversal of a binary tree. The goal is to construct a special binary tree from that array. A special binary tree is the one which has root node’s weight greater than the weights of both its left and right children.For ExampleInputint ... Read More

Count pairs in a binary tree whose sum is equal to a given value x in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 07-Jan-2021 06:55:14

225 Views

We are given an integer value and a variable x and the task is to construct the binary tree and find the pairs having sum equals to the given value x.For ExampleInputint x = 5, The tree which will be created after inputting the values is given below −OutputCount of ... Read More

Construct the full k-ary tree from its preorder traversal in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 07-Jan-2021 06:44:20

454 Views

We are given an array arr[] containing the preorder traversal of the k-ary tree in sequence. The goal is to construct the same k-ary tree from it and print its postorder traversal. A full k−ary tree is the one in which the root node has 0 or k children i.e. ... Read More

Count the nodes whose sum with X is a Fibonacci number in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 07-Jan-2021 06:37:55

154 Views

Given a binary tree with weights of its nodes as numbers. The goal is to find the number of nodes that have weights such that the number is a Fibonacci number. Numbers in Fibonacci series are: 0, 1, 1, 2, 3, 5, 8, 13….nth number is the sum of (n−1)th ... Read More

Construct Pushdown automata for L = {a(2*m)c(4*n)dnbm | m,n = 0} in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 07-Jan-2021 06:33:49

733 Views

We are given with a language “L” and the task is to construct a pushdown automata for the given language which explains that the occurrences of character ‘a’ should be doubles the time of occurrence of character ‘b’ and occurrences of character ‘c’ should be quadruples the times of ‘d’ ... Read More

Construct Pushdown automata for L = {0n1m2m3n | m,n = 0} in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 07-Jan-2021 06:32:01

806 Views

We are given with a language “L” and the task is to construct a pushdown automata for the given language which explains that the occurrences of 0’s and 3’s will be equal and occurrences of 1’s and 2’s will be equal and also occurrences of all the numbers should be ... Read More

Construct Pushdown automata for L = {0n1m2(n+m) | m,n = 0} in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 07-Jan-2021 06:30:10

453 Views

We are given with a language “L” and the task is to construct a pushdown automata for the given language which explains that the occurrences of 2’s will be the addition of occurrences of 0’s and 1’s and also, occurrence of 0 and 1 will be minimum one which can ... Read More

Construct Pushdown automata for L = {0m1(n+m)2n | m,n = 0} in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 07-Jan-2021 05:27:09

589 Views

We are given with a language “L” and the task is to construct a pushdown automata for the given language which explains that the occurrences of 1’s will be the addition of occurrences of 0’s and 2’s and also, occurrence of 0 and 2 will be minimum one which can ... Read More

Advertisements