Skip to content
playdsa
Preferences

Make yourself comfortable.

Saved on this browser. Your device’s reduced-motion preference is always respected.

Theme
Advanced settings

The Traversal Builder

Learn
Play
Prove
Problem context and objectives
Mission briefing

Archive pathfinder · Clues branch through a living archive

Explore only the branches that can still contain the answer: The Traversal Builder.

Ignoring the parent-child rule turns a focused search into a full maze traversal.

How you win

  1. 1Recognize when Construct tree from preorder and inorder matches the clues
  2. 2Keep this true after every move: build(preStart,left,right) constructs exactly the inorder interval using its corresponding preorder slice
  3. 3Reach the result within O(n) time with an inorder index map

Rules and pressure

  • Target cost: O(n) time with an inorder index map
  • State rule: build(preStart,left,right) constructs exactly the inorder interval using its corresponding preorder slice
Lesson 1 of 3

Take the next root from preorder and choose its exact divider position inside the active inorder interval.

Take the root from preorder and split the inorder rail around it.

Your call · Root 3 is at inorder index 1. How many nodes belong to its left subtree?

Help shape PlayDSA

Something confusing, broken, or missing? Leave a quick note without leaving your lesson.

Please leave out passwords, payment details and other private information.

Page included: /

Sign in to save feedback here, or send it with your email app. Your draft stays here while you sign in.

Open email instead