N-ary Tree PreOrder Traversal 2

Title: N-ary Tree Preorder Traversal Source: leetcode.com Given an n-ary tree, return the preorder traversal of its nodes’ values. For example, given a 3-ary tree: Return its preorder traversal as: [1,3,5,6,2,4]. Note: Recursive solution is trivial, could you do it iteratively? You could find another explanation/ problem related to Preorder Traversal here. Java solution (Recursive) ...

Verify Preorder Serialization of a Binary Tree 4

Title: Verify Preorder Serialization of a Binary Tree Source: leetcode.com One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node’s value. If it is a null node, we record using a sentinel value such as #. _9_ / \ 3 2 / \ ...