Skip to content
This repository was archived by the owner on Jun 26, 2025. It is now read-only.

Commit d5709fc

Browse files
committed
Added small clarification to postfix and prefix notation in tree-recipes
1 parent 7dbafea commit d5709fc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

competition/tree-recipes/prob.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ Division A wants to receive these recipes in
2929
while Division B wants to receive these recipes in
3030
[*prefix*](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order,_NLR) notation.
3131

32+
To clarify, let us consider one tree node named `A`,
33+
that has two child nodes: `B` and `C`.
34+
**Postfix** notation writes the contents of all child nodes before the node itself,
35+
hence `B C A` would be the postfix notation of the structure of node `A`.
36+
Meanwhile, **prefix** notation writes the node first, before the child nodes.
37+
Hence, `A B C` would be the prefix notation of the structure of node `A`.
38+
3239
The format of these trees is as follows:
3340
Every node in the tree is named by either **three letters** or a **number**.
3441
A word (e.g., `abc`) indicates a leaf node, while

0 commit comments

Comments
 (0)