Skip to content

Instantly share code, notes, and snippets.

@rozer007
Last active October 22, 2021 06:37
Show Gist options
  • Save rozer007/e16ec20c7d344cefbf563dd87e66085b to your computer and use it in GitHub Desktop.
Save rozer007/e16ec20c7d344cefbf563dd87e66085b to your computer and use it in GitHub Desktop.
Generic Tree - Traversals (pre-order, Post-order)
Description:
"Traversals in Generic Tree" where we are going to discuss Pre-order and Post-order traversals.
This is a great question to get in depth knowledge on how traversals work which will be beneficial for understanding other questions as well.
Question Name:
Generic Tree - Traversals (pre-order, Post-order)
Question Link:
https://www.pepcoding.com/resources/online-java-foundation/generic-tree/generic-tree-traversal-official/ojquestion
Question Statement:
1. You are given a partially written GenericTree class.
2. You are required to complete the body of traversals function. The function is expected to visit every node. While traversing the function must print following content in different situations.
2.1. When the control reaches the node for the first time -> "Node Pre" node.data.
2.2. Before the control leaves for a child node from a node -> "Edge Pre"node.data--child.data.
2.3. After the control comes back to a node from a child -> "Edge Post" node.data--child.data.
2.4. When the control is about to leave node, after the children have been visited -> "Node Post" node.data.
3. Input is managed for you.
4. For more detail watch the video.
Topic: #Tree #GenericTree #Traversals
Used #DataStructure: #DFS #Recursion
#TimeComplexity: O(2^N)
#SpaceComplexity: O(1)
--------------------------------------------------------------
More Youtube PlayList:
Level 1 In Java English : https://www.youtube.com/playlist?list=PL-Jc9J83PIiHxc8vuYMq3C1KUvqc_jB6L
Level 1 In Java Hindi : https://www.youtube.com/playlist?list=PL-Jc9J83PIiFj7YSPl2ulcpwy-mwj1SSk
Level 2 In Java Hindi : https://www.youtube.com/playlist?list=PL-Jc9J83PIiE-181crLG1xSIWhTGKFiMY
Constructive Algorithm - Level 3 : https://www.youtube.com/playlist?list=PL-Jc9J83PIiGRNj_KILSAuhvAHS4_4Y5N
Geometry - Level 3 : https://www.youtube.com/playlist?list=PL-Jc9J83PIiH0l9IZvdeC55dbFQpdMDSS
Maths for CP - Level 3 : https://www.youtube.com/playlist?list=PL-Jc9J83PIiFs8E0EGeckM89cD8E6sFro
DP - Level 3 : https://www.youtube.com/playlist?list=PL-Jc9J83PIiG1ebya3hpf65MgYYyDkK4W
Euler Tour - Level 3 : https://www.youtube.com/playlist?list=PL-Jc9J83PIiHymm1DHZBkac0_hhFBXryO
Ternary Search : https://www.youtube.com/playlist?list=PL-Jc9J83PIiGiFr2WFAiS9nEssqEoCKC4
Recursion & Backtracking - Level 1 : https://www.youtube.com/playlist?list=PL-Jc9J83PIiFxaBahjslhBD1LiJAV7nKs
Recursion & Backtracking - Level 2 : https://www.youtube.com/playlist?list=PL-Jc9J83PIiHO9SQ6lxGuDsZNt2mkHEn0
Graphs - Level 1 : https://www.youtube.com/playlist?list=PL-Jc9J83PIiHfqDcLZMcO9SsUDY4S3a-v
Dyanmic Programming - Level 1 : https://www.youtube.com/playlist?list=PL-Jc9J83PIiG8fE6rj9F5a6uyQ5WPdqKy
Generic Trees - Level 1 : https://www.youtube.com/playlist?list=PL-Jc9J83PIiEmjuIVDrwR9h5i9TT2CEU_
Time and Space - Level 1 : https://www.youtube.com/playlist?list=PL-Jc9J83PIiFc7hJ5eeCb579PS8p-en4f
---------------------------------------------------------------
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 visit our website: https://bit.ly/2ZCS68a
For more free study resources, visit: https://bit.ly/3liICaJ
Have a look at our result: https://bit.ly/2YcmDZR
Follow us on our Youtube page: https://www.youtube.com/c/Pepcoding/featured
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/pepcoding-education
Follow us on Pinterest: https://in.pinterest.com/Pepcoding/_created/
Follow us on Twitter: https://twitter.com/pepcoding
.
.
.
Happy Programming !!! Pep it up
----------------------------------------------------------------
#Tree #GenericTree #Traversals(pre-order, Post-order)OfTree #Traversals(pre-order, Post-order)OfGenericTree
=================================================================
Tags:
coding, pepcoding, pep, programming, softwareDevelopment, Internship, SDE Questions, NADOS, JAVA, CPP, java language, java in english, pepcoding in english, java in english, Generic tree, Generic tree in english, Generic tree in hindi, Traversals (pre-order, Post-order) in tree,Traversals (pre-order, Post-order) in generic tree, Generic tree Traversals (pre-order, Post-order) in english, Generic tree Traversals (pre-order, Post-order) in hindi, sumeet sir, rajneesh sir, jeetu sir, jasbir sir, jitender sir, subesh sir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment