Your task is to implement the following function :
void inorder(TreeNode*)
You will be working with the following structure :
struct TreeNode {
int x;
struct TreeNode* L;
struct TreeNode* R;
}
You may only edit the BODY of the code, leaving the HEAD and the TAIL as it is.
Sample Input 0
7
4 2 1 3 6 7 5
Sample Output 0
1 2 3 4 5 6 7
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner sc =new Scanner(System.in);
int n=sc.nextInt();
int ar[]=new int[n];
for(int i=0;i<n;i++)
ar[i]=sc.nextInt();
Arrays.sort(ar);
for(int i=0;i<n;i++)
System.out.print(ar[i]+" ");
}
}