Back to marketplace

Tree-traversal

No description yet. This curated deck is ready for daily study.

Total cards: 10•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (10)

#1
Front (Question)

What are the 3 most common algorithms for traversing trees?

Back (Answer)

Pre-order, post-order and in-order

#2
Front (Question)

Define pre-order

Back (Answer)

Specifies the point in traversal where the node contents are processed

#3
Front (Question)

What happens to a node when it’s visited?

Back (Answer)

A nodes contents are outputted

#4
Front (Question)

How many times can a node be visited?

Back (Answer)

Multiple times but it’s contents can only be processed once

#5
Front (Question)

What makes pre-order traversal special?

Back (Answer)

Each node is visited before the algorithm traverses either of the nodes subtrees

#6
Front (Question)

State the simplified recursive algorithm for a left-right pre-order traversal

Back (Answer)

Visit the node Pre-order traverse of nodes left sub tree pre-order traverse of the nodes right subtree

#7
Front (Question)

What happens in an in-order traversal?

Back (Answer)

Each node is visited between each of it’s subtrees

#8
Front (Question)

State the simplified algorithm for a left-right in-order traversal

Back (Answer)

Do an in-order traversal of the whole left subtree visit the node in-order traverse the right subtree

#9
Front (Question)

What happens in a post-order traversal?

Back (Answer)

Each node is visited after both of it’s subtrees

#10
Front (Question)

State the simplified recursive algorithm for a left-right post-order traversal

Back (Answer)

Do a post-order traversal of the left subtree Do a post-order traversal of the right subtree Visit the node