Non-recursive Algorithm Which Constructs The Binary Tree With Traversal Sequence
Lu Liu
Abstract
Lu Liu
Abstract
There are many methods to construct a binary tree.Provide the node sequences of a inorder traversal and postorder traversal,then a binary tree can be constructed.Recursive algorithm is usually used.A recursive algorithm structure is simple,clear and readable.But a recursive algorithm will cost too much time and space during the process.We should transform the recursive algorithm into a non-recursive algorithm for time and space efficiency.A non-recursive algorithm is given,which inputs the node sequences of a binary tree for inorder traversal and postorder traversal and constructs the binary tree.The algorithm is optimal for the problem with time complexity O(n),where n is the number of the nodes of the tree.
OpenAlex reports 1 citations for this work. Citation counts describe recorded attention and do not establish research quality.
A contribution statement is not available in the OpenAlex record.
Method details are not available in the OpenAlex metadata.
Findings are not separately available in the OpenAlex metadata.
Limitations are not available in the OpenAlex metadata.
Application details are not available in the OpenAlex metadata.
There are many methods to construct a binary tree.Provide the node sequences of a inorder traversal and postorder traversal,then a binary tree can be constructed.Recursive algorithm is usually used.A recursive algorithm structure is simple,clear and readable.But a recursive algorithm will cost too much time and space during the process.We should transform the recursive algorithm into a non-recursive algorithm for time and space efficiency.A non-recursive algorithm is given,which inputs the node sequences of a binary tree for inorder traversal and postorder traversal and constructs the binary tree.The algorithm is optimal for the problem with time complexity O(n),where n is the number of the nodes of the tree.
Key concepts: Tree traversal, Binary tree, Optimal binary search tree, Algorithm, Tree (set theory), Computer science, Node (physics), Binary search tree