Source : https://www.hackerrank.com/challenges/tree-inorder-traversal
Complete the inOrder function in your editor below, which has parameter: a pointer to the root of a binary tree. It must print the values in the tree's inorder traversal as a single line of space-separated values.
Input Format
Our hidden tester code passes the root node of a binary tree to your inOrder function.
Constraints
1 Nodes in the tree 500
Output Format
Print the tree's inorder traversal as a single line of space-separated values.
Sample Input
1 \ 2 \ 5 / \ 3 6 \ 4
Sample Output
1 2 3 4 5 6
Source : https://www.hackerrank.com/challenges/tree-inorder-traversal
Solution
// Karthikalapati.blogspot.com | |
/* | |
Node is defined as | |
class Node { | |
int data; | |
Node left; | |
Node right; | |
} | |
*/ | |
void inOrder(Node n) { | |
if (n != null) { | |
inOrder(n.left); | |
System.out.print(n.data + " "); | |
inOrder(n.right); | |
} | |
} |
Microsoft Windows 8.1
ReplyDeleteMicrosoft Windows 8.1 PC Product License Key This Product is delivered electronically and does not consist of any DVD, USB or any media. Delivery time is sameday (can take up to 24 hours) You will receive via Email: Official software product license
https://softwarebase.uk/microsoft-windows-8-1