Grokking the Art of Recursion for Coding Interviews
Ask Author
Back to course home

0% completed

Solution: BST Inorder Traversal

Problem Statement

Write Recursive Approach for Inorder Traversal of Binary Tree.

Given a binary tree, write a recursive algorithm to perform an inorder traversal of the tree and return the elements in the order they were visited.

Examples

Example 1:

Input: 5 / \ 3 8 / \ / \ 2 4 7 9 Output: Inorder Traversal: [2, 3, 4, 5, 7, 8, 9] Explanation: The binary tree has the following structure: 5 / \ 3 8 / \ / \

.....

.....

.....

Like the course? Get enrolled and start learning!