- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7347 Articles for C++
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
441 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’ and also occurrences of all the characters should be minimum 1 which can also makes the string NULL and it should be accepted by the automata.What is pushdown Automata?A pushdown automata or pushdown automaton or PDA is a technique to implement a context-free grammar in a similar way we design ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
535 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 minimum 1 which can also makes the string NULL and it should be accepted by the automata.What is pushdown Automata?A pushdown automata or pushdown automaton or PDA is a technique to implement a context−free grammar in a similar way we design Deterministic Finite Automaton or DFA for a regular grammar. ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
432 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 also makes the string NULL and it should be accepted by the automata.What is pushdown Automata?A pushdown automata or pushdown automaton or PDA is a technique to implement a context−free grammar in a similar way we design Deterministic Finite Automaton or DFA for a regular grammar. A DFA can operate ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
354 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 also makes the string NULL and it should be accepted by the automata.What is pushdown Automata?A pushdown automata or pushdown automaton or PDA is a technique to implement a context−free grammar in a similar way we design Deterministic Finite Automaton or DFA for a regular grammar. A DFA can operate ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
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 will be created after inputting the values is given below −OutputCount the nodes of the tree whose weighted string contains a vowel are: 5Explanationwe are given with the tree nodes and the string weights associated with each node. Now we check whether the string of nodes contains vowels or not.NodeWeightvowelsyes/no2aeeyes1bcdNo ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
90 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 inputting the values is given below −OutputCount the nodes whose weight is a perfect square are: 4Explanationwe are given with the tree nodes and the weights associated with each node. Now we check whether the digits of nodes are perfect squares or not.NodeWeightPerfect squareYes/no212111*11yes1819*9yes437Prime numberno3255*5yes810010*10yes9701Not possiblenoInputThe tree which will be ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
171 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 inputting the values is given below −OutputCount the nodes in the given tree whose weight is a power of two are: 3Explanationwe are given with the tree node and the weights associated with each node. Now we calculate the power of each and every weight and check whether it can ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
179 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 this node will be counted.For ExampleInputThe tree which will be created after inputting the values is given below −OutputCount of nodes in the given tree whose sum of digits of weight is odd are: 2Explanationwe are given with the tree node and the weights associated with each node. Now we ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
259 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 subtrees that sum up to a given value x are: 1Explanationwe are given with a x value as 14. As we can see there is only one leaf node with the values as 14 therefore the count is 1.Inputx = 33. The tree which will be created after inputting the ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
251 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: 4ExplanationThe subarrays will be: [ 8 ], [ 5, 8 ], [ 1, 5, 8 ], [ 2, 1, 5, 8 ].Inputarr[] = {7, 1, 9, 7} k=9OutputCount of sub−arrays whose product is divisible by k are: 6ExplanationThe subarrays will be: [ 9 ], [ 9, 7 ], [ 1, ... Read More