Sorted order printing of a given array that represents a BST | C # Code for Sorted order printing of a given array that represents a BST ; print left subtree ; print root ; print right subtree ; Driver Code
using System ; class GFG { static private void printSorted ( int [ ] arr , int start , int end ) { if ( start > end ) return ; printSorted ( arr , start * 2 + 1 , end ) ; Console . Write ( arr [ start ] + " ▁ " ) ; printSorted ( arr , start * 2 + 2 , end ) ; } static public void Main ( String [ ] args ) { int [ ] arr = { 4 , 2 , 5 , 1 , 3 } ; printSorted ( arr , 0 , arr . Length - 1 ) ; } }