Created
January 15, 2022 04:26
-
-
Save Shivani13121007/0d140997a4e66bf5c2ead46cec6b8e1b to your computer and use it in GitHub Desktop.
Delete Nodes And Return Forest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that. | |
NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. In this question we print numbers in Increasing Order and Decreasing Order. | |
Question Name: | |
Delete Nodes And Return Forest | |
Question Link: | |
https://nados.io/question/delete-nodes-and-return-forest | |
Question Statement: | |
Given the root of a binary tree, each node in the tree has a distinct value. | |
After deleting all nodes with a value in to_delete, we are left with a forest (a disjoint union of trees). | |
Return the roots of the trees in the remaining forest. You may return the result in any order. | |
Topic: #Delete Nodes And Return Forest #trees #binary Tree | |
#TimeComplexity: O(N) | |
#SpaceComplexity: O(n-k) | |
Where k is the number of nodes being deleted from a tree. | |
-------------------------------------------------------------- | |
More Youtube PlayList: | |
Level 1 In Java English : https://www.youtube.com/playlist?list... | |
Level 1 In Java Hindi : https://www.youtube.com/playlist?list... | |
Level 2 In Java Hindi : https://www.youtube.com/playlist?list... | |
Constructive Algorithm - Level 3 : https://www.youtube.com/playlist?list... | |
Geometry - Level 3 : https://www.youtube.com/playlist?list... | |
Maths for CP - Level 3 : https://www.youtube.com/playlist?list... | |
DP - Level 3 : https://www.youtube.com/playlist?list... | |
Euler Tour - Level 3 : https://www.youtube.com/playlist?list... | |
Ternary Search : https://www.youtube.com/playlist?list... | |
Recursion & Backtracking - Level 1 : https://www.youtube.com/playlist?list... | |
Recursion & Backtracking - Level 2 : https://www.youtube.com/playlist?list... | |
Graphs - Level 1 : https://www.youtube.com/playlist?list... | |
Dyanmic Programming - Level 1 : https://www.youtube.com/playlist?list... | |
Generic Trees - Level 1 : https://www.youtube.com/playlist?list... | |
Time and Space - Level 1 : https://www.youtube.com/playlist?list... | |
--------------------------------------------------------------- | |
Pepcoding has taken the initiative to provide counselling and learning resources to all curious, skillful and dedicated Indian coders. This video is part of the series to impart industry-level web development and programming skills in the community. | |
We also provide professional courses with live classes and placement opportunities. | |
For more free study resources and information about the courses, visit: https://www.pepcoding.com/resources/ | |
Have a look at our result: https://www.pepcoding.com/placements | |
Follow us on our Youtube page: https://www.youtube.com/c/Pepcoding/f... | |
Follow us on our FB page: https://www.facebook.com/pepcoding | |
Follow us on Instagram: https://www.instagram.com/pepcoding | |
Follow us on LinkedIn: https://www.linkedin.com/company/pepc... | |
Follow us on Pinterest: https://in.pinterest.com/Pepcoding/_c... | |
Follow us on Twitter: https://twitter.com/home | |
. | |
. | |
. | |
Happy Programming !!! Pep it up | |
---------------------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment