Sunidhi Bansal has Published 1100 Articles

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

Sunidhi Bansal

Sunidhi Bansal

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

533 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

266 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

429 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

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

Sunidhi Bansal

Sunidhi Bansal

Updated on 07-Jan-2021 05:24:22

351 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 will be the addition of occurrences of 1’s and 2’s and also, occurrence of 1 and 2 will be minimum one which can ... Read More

Count the nodes in the given tree whose weight is a power of two in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 05-Jan-2021 14:58:58

170 Views

Given a binary tree with weights of its nodes. The goal is to find the number of nodes that have weights such that the number is power of two. If weight is 32 then it is 25 so this node will be counted.For ExampleInputThe tree which will be created after ... Read More

Count the nodes whose weight is a perfect square in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 05-Jan-2021 14:57:18

87 Views

Given a binary tree with weights of its nodes. The goal is to find the number of nodes that have weights such that the number is a perfect square. If weight is 36 then it is 62 so this node will be counted.For ExampleInputThe tree which will be created after ... Read More

Count the nodes of the tree whose weighted string contains a vowel in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 05-Jan-2021 14:53:08

132 Views

Given a binary tree with weights of its nodes as strings. The goal is to find the number of nodes that have weights such that the string contains a vowel. If weight is ‘aer’ then it has vowels ‘a’ and ‘e’ so the node will be counted.For ExampleInputThe tree which ... Read More

Count the nodes in the given tree whose sum of digits of weight is odd in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 05-Jan-2021 13:56:22

178 Views

Given a binary tree with weights of its nodes. The goal is to find the number of nodes that have weights such that the sum of digits in that weights add up to an odd number. If weight is 12 then the digit sum is 3 which is odd so ... Read More

Count subtrees that sum up to a given value x in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 05-Jan-2021 13:39:31

258 Views

Given a binary tree and a value x as input. The goal is to find all the subtrees of a binary tree that have sum of weights of its nodes equal to x.For ExampleInputx = 14. The tree which will be created after inputting the values is given belowOutputCount of ... Read More

Count subarrays whose product is divisible by k in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 05-Jan-2021 13:36:48

245 Views

Given an array arr[] and an integer k as input. The goal is to find the number of subarrays of arr[] such that the product of elements of that subarray is divisible by k.For ExampleInputarr[] = {2, 1, 5, 8} k=4OutputCount of sub-arrays whose product is divisible by k are: ... Read More

Advertisements