“Create a binary tree with A as root, B and C as its left and right children, D and E under B, H under D, and F and G under C, for practising tree traversals.”
그 이면의 의사결정을 읽어 보세요.
Give the root two children and each child two leaves.
Make traversal order easy to read.
Use the same tree for preorder, inorder and postorder.
Use this small tree for introductory traversal exercises.
자주 묻는 질문
What is preorder traversal?
Visit the root, then the left subtree, then the right subtree.
What is inorder traversal?
Visit the left subtree, then the root, then the right subtree.
What is postorder traversal?
Visit the left subtree, then the right subtree, then the root.