HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

From in-order representation to binary tree

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
orderbinaryrepresentationfromtree

Problem

Is there a way to reconstruct a binary tree just from its in-order representation?

I've searched the internet, but I could only find solutions for reconstructing a binary tree from inorder and preorder representations, but none for only inorder.

Solution

The in-order traversal is not unique. The above trees have the same sequence 1,2,3,4,5. (They are isomorphic, but I assumed you consider ordered binary trees.)

Context

StackExchange Computer Science Q#2817, answer score: 6

Revisions (0)

No revisions yet.