Master programming syntax, solve interactive challenges & run live code in Syntaxis Explore Arena →
menu_book Course Curriculum (Data Structures & Algorithms) expand_more
Complexity & Foundations
Arrays & Strings
Linked Lists
Stacks & Queues
Hashing
Trees & Heaps
Graphs
Sorting Searching & DP

Binary tree traversal

Learn Binary tree traversal in Data Structures & Algorithms with a focused explanation, a topic-specific example, edge guidance, and a mastery check.

12 min read • Intermediate
data-structures-algorithms-051.py
python
tree={"v":8,"l":{"v":3,"l":None,"r":None},"r":{"v":10,"l":None,"r":None}}
def walk(n):
    if n:
        print(n["v"]);walk(n["l"]);walk(n["r"])
walk(tree)
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content