educative.io

Is the middle element of an inorder traversal really the root?

From the lesson:

In an inorder traversal, the order of traversal is left, root, and then right. Therefore, the middle element will be the root

Is this true for all binary trees? e.g.:

    3
   /
  2
 /
1

inorder: [1, 2, 3]

In this case, the middle element, 2, isn’t the root


Course: Grokking Coding Interview Patterns in Python - AI-Powered Learning for Developers
Lesson: Solution: Build Binary Tree from Preorder and Inorder Traversal - Grokking Coding Interview Patterns in Python