
Asked in Jio
Inorder Traversal of Binary Tree
You are provided with a binary tree consisting of 'N' nodes, where each node carries an integer value. Your task is to determine the in-order traversal of the given binary tree.
Example:
Input:
For the given binary tree:
1 3 8 5 2 7 -1 -1 -1 -1 -1 -1 -1
Output:
The Inorder traversal will be [5, 3, 2, 1, 7, 4, 6].
Explanation:
The input represents the level order traversal of the binary tree. Each level is denoted consecutively, and a '-1' symbolizes a null node. For example:
[
Level 1: 1
Level 2: 3 8
Level 3: 5 2 7 -1
]
Constraints:
1 <= T <= 10
0 <= N <= 3000
0 <= data <= 10^9
- Time limit: 1 second
Input:
The first line contains an integer 'T' which denotes the number of test cases.
The first line of each test case contains elements of the tree in level order. Values of nodes are separated by a single space, with -1 representing a null node.
Output:
For each test case, return a vector containing the in-order traversal as space-separated integers.
Note:
- No need to print the output, focus on implementing the function to return results.
- The input terminates when all elements at the lowest level are null (-1).

AnswerBot
1y
The task is to find the in-order traversal of a given binary tree.
Implement a recursive function to perform in-order traversal of the binary tree
Start from the left subtree, then visit the root, and f...read more
Venky
4mo
works at
Hgvhj
Single person can have a maximum of nine active slam Varada registered under their Aadhaar card for daily use
Help your peers!
Add answer anonymously...
Top Software Developer Interview Questions Asked at Jio
Q. How do you optimize React applications?
Q. Use any public API to fetch data and display it as a list on the screen.
Q. Count the frequency of letters in a sentence with a method having least time com...read more
Interview Questions Asked to Software Developer at Other Companies
Top Skill-Based Questions for Jio Software Developer
Algorithms Interview Questions and Answers
250 Questions
Data Structures Interview Questions and Answers
250 Questions
Web Development Interview Questions and Answers
250 Questions
Java Interview Questions and Answers
250 Questions
SQL Interview Questions and Answers
250 Questions
Software Development Interview Questions and Answers
250 Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

