Given a binary tree in such a way such that the level order traversal of a binary tree produces a string S. The task is to remove all vowels from the binary tree and print the level order traversal of the remaining tree.
Input: G / \ E E / \ K S Output: G / \ K S Input: G / \ O A / L Output: G / L
- Perform a level order insertion of the characters in the string.
- Declare a new binary tree with its root set to NULL.
- Perform a level order traversal of the binary tree.
- In case a vowel is encountered, do not add it to the new binary tree.
- Otherwise add the character to the new binary tree.
- Perform a level order traversal of the new tree.
Below is the implementation of the above approach:
- Program to remove vowels from a String
- Remove consecutive vowels from string
- Remove all multiples of K from Binary Tree
- Given a binary tree, how do you remove all the half nodes?
- Ways to remove one element from a binary string so that XOR becomes zero
- Minimum steps to remove substring 010 from a binary string
- Binary tree to string with brackets
- Check if a string can be converted to another string by replacing vowels and consonants
- Construct Binary Tree from String with bracket representation
- Complexity of different operations in Binary tree, Binary Search Tree and AVL tree
- Minimum swap required to convert binary tree to binary search tree
- Check whether a binary tree is a full binary tree or not | Iterative Approach
- First X vowels from a string
- Reverse vowels in a given string
- Modify the string such that it contains all vowels at least once
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : 29AjayKumar