codeparrot/xlcost-text-to-code huggingface dataset:
Lowest Common Ancestor in a Binary Tree | Set 1 | c # implementation to find lowest common ancestor of n1 and n2 using one traversal of binary tree It also handles cases even when n1 and n2 are not there in Tree ; Class containing left and right child of current node and key ; Root of the Binary Tree ; This function returns pointer to LCA of two given values n1 and n2 . v1 is set as true by this function if n1 is found v2 is set as true by this function if n2 is found ; Base case ; Store result in temp , in case of key match so that we can search for other key also . ; If either n1 or n2 matches with root 's key, report the presence  by setting v1 or v2 as true and return root (Note that if a key is ancestor of other, then the ancestor key becomes LCA) ; Look for keys in left and right subtrees ; If both of the above calls return Non - NULL , then one key is present in once subtree and other is present in other , So this node is the LCA ; Otherwise check if left subtree or right subtree is LCA ; Finds lca of n1 and n2 under the subtree rooted with ' node ' ; Initialize n1 and n2 as not visited ; Find lca of n1 and n2 using the technique discussed above ; Return LCA only if both n1 and n2 are present in tree ; Else return NULL ; Driver program to test above functions
using System ; public class Node { public int data ; public Node left , right ; public Node ( int item ) { data = item ; left = right = null ; } } public class BinaryTree { public Node root ; public static bool v1 = false , v2 = false ; public virtual Node findLCAUtil ( Node node , int n1 , int n2 ) { if ( node == null ) { return null ; } Node temp = null ; if ( node . data == n1 ) { v1 = true ; temp = node ; } if ( node . data == n2 ) { v2 = true ; temp = node ; } Node left_lca = findLCAUtil ( node . left , n1 , n2 ) ; Node right_lca = findLCAUtil ( node . right , n1 , n2 ) ; if ( temp != null ) { return temp ; } if ( left_lca != null && right_lca != null ) { return node ; } return ( left_lca != null ) ? left_lca : right_lca ; } public virtual Node findLCA ( int n1 , int n2 ) { v1 = false ; v2 = false ; Node lca = findLCAUtil ( root , n1 , n2 ) ; if ( v1 && v2 ) { return lca ; } return null ; } public static void Main ( string [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 1 ) ; tree . root . left = new Node ( 2 ) ; tree . root . right = new Node ( 3 ) ; tree . root . left . left = new Node ( 4 ) ; tree . root . left . right = new Node ( 5 ) ; tree . root . right . left = new Node ( 6 ) ; tree . root . right . right = new Node ( 7 ) ; Node lca = tree . findLCA ( 4 , 5 ) ; if ( lca != null ) { Console . WriteLine ( " LCA ( 4 , ▁ 5 ) ▁ = ▁ " + lca . data ) ; } else { Console . WriteLine ( " Keys ▁ are ▁ not ▁ present " ) ; } lca = tree . findLCA ( 4 , 10 ) ; if ( lca != null ) { Console . WriteLine ( " LCA ( 4 , ▁ 10 ) ▁ = ▁ " + lca . data ) ; } else { Console . WriteLine ( " Keys ▁ are ▁ not ▁ present " ) ; } } }
Lowest Common Ancestor in a Binary Tree | Set 2 ( Using Parent Pointer ) | A tree node ; A utility function to insert a new node with given key in Binary Search Tree ; If the tree is empty , return a new node ; Otherwise , recur down the tree ; return the ( unchanged ) node pointer ; To find LCA of nodes n1 and n2 in Binary Tree ; Creata a map to store ancestors of n1 ; Insert n1 and all its ancestors in map ; Check if n2 or any of its ancestors is in map . ; Driver code
using System ; using System . Collections ; using System . Collections . Generic ; public class Node { public int key ; public Node left , right , parent ; public Node ( int key ) { this . key = key ; left = right = parent = null ; } } class BinaryTree { Node root , n1 , n2 , lca ; Node insert ( Node node , int key ) { if ( node == null ) return new Node ( key ) ; if ( key < node . key ) { node . left = insert ( node . left , key ) ; node . left . parent = node ; } else if ( key > node . key ) { node . right = insert ( node . right , key ) ; node . right . parent = node ; } return node ; } Node LCA ( Node n1 , Node n2 ) { Dictionary < Node , Boolean > ancestors = new Dictionary < Node , Boolean > ( ) ; while ( n1 != null ) { ancestors . Add ( n1 , true ) ; n1 = n1 . parent ; } while ( n2 != null ) { if ( ancestors . ContainsKey ( n2 ) ) return n2 ; n2 = n2 . parent ; } return null ; } public static void Main ( String [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = tree . insert ( tree . root , 20 ) ; tree . root = tree . insert ( tree . root , 8 ) ; tree . root = tree . insert ( tree . root , 22 ) ; tree . root = tree . insert ( tree . root , 4 ) ; tree . root = tree . insert ( tree . root , 12 ) ; tree . root = tree . insert ( tree . root , 10 ) ; tree . root = tree . insert ( tree . root , 14 ) ; tree . n1 = tree . root . left . right . left ; tree . n2 = tree . root . left ; tree . lca = tree . LCA ( tree . n1 , tree . n2 ) ; Console . WriteLine ( " LCA ▁ of ▁ " + tree . n1 . key + " ▁ and ▁ " + tree . n2 . key + " ▁ is ▁ " + tree . lca . key ) ; } }
Lowest Common Ancestor in a Binary Tree | Set 2 ( Using Parent Pointer ) | C # program to find lowest common ancestor using parent pointer ; A tree node ; A utility function to insert a new node with given key in Binary Search Tree ; If the tree is empty , return a new node ; Otherwise , recur down the tree ; return the ( unchanged ) node pointer ; A utility function to find depth of a node ( distance of it from root ) ; To find LCA of nodes n1 and n2 in Binary Tree ; Find depths of two nodes and differences ; If n2 is deeper , swap n1 and n2 ; Move n1 up until it reaches the same level as n2 ; Now n1 and n2 are at same levels ; Driver Code
using System ; public class Node { public int key ; public Node left , right , parent ; public Node ( int key ) { this . key = key ; left = right = parent = null ; } } class GFG { public Node root , n1 , n2 , lca ; public virtual Node insert ( Node node , int key ) { if ( node == null ) { return new Node ( key ) ; } if ( key < node . key ) { node . left = insert ( node . left , key ) ; node . left . parent = node ; } else if ( key > node . key ) { node . right = insert ( node . right , key ) ; node . right . parent = node ; } return node ; } public virtual int depth ( Node node ) { int d = - 1 ; while ( node != null ) { ++ d ; node = node . parent ; } return d ; } public virtual Node LCA ( Node n1 , Node n2 ) { int d1 = depth ( n1 ) , d2 = depth ( n2 ) ; int diff = d1 - d2 ; if ( diff < 0 ) { Node temp = n1 ; n1 = n2 ; n2 = temp ; diff = - diff ; } while ( diff -- != 0 ) { n1 = n1 . parent ; } while ( n1 != null && n2 != null ) { if ( n1 == n2 ) { return n1 ; } n1 = n1 . parent ; n2 = n2 . parent ; } return null ; } public static void Main ( string [ ] args ) { GFG tree = new GFG ( ) ; tree . root = tree . insert ( tree . root , 20 ) ; tree . root = tree . insert ( tree . root , 8 ) ; tree . root = tree . insert ( tree . root , 22 ) ; tree . root = tree . insert ( tree . root , 4 ) ; tree . root = tree . insert ( tree . root , 12 ) ; tree . root = tree . insert ( tree . root , 10 ) ; tree . root = tree . insert ( tree . root , 14 ) ; tree . n1 = tree . root . left . right . left ; tree . n2 = tree . root . right ; tree . lca = tree . LCA ( tree . n1 , tree . n2 ) ; Console . WriteLine ( " LCA ▁ of ▁ " + tree . n1 . key + " ▁ and ▁ " + tree . n2 . key + " ▁ is ▁ " + tree . lca . key ) ; } }
Print common nodes on path from root ( or common ancestors ) | C # Program to find common nodes for given two nodes ; Class to represent Tree node ; Class to count full nodes of Tree ; Utility function to find the LCA of two given values n1 and n2 . ; Base case ; If either n1 or n2 matches with root 's key,   report the presence by returning root (Note   that if a key is ancestor of other, then the   ancestor key becomes LCA  ; Look for keys in left and right subtrees ; If both of the above calls return Non - NULL , then one key is present in once subtree and other is present in other , So this node is the LCA ; Otherwise check if left subtree or right subtree is LCA ; Utility Function to print all ancestors of LCA ; base cases ; If target is present in either left or right subtree of this node , then print this node ; Else return false ; Function to find nodes common to given two nodes ; Driver program to test above functions ; Let us create Binary Tree shown in above example
using System ; public class Node { public int data ; public Node left , right ; public Node ( int item ) { data = item ; left = null ; right = null ; } } public class BinaryTree { public static Node root ; public static Node findLCA ( Node root , int n1 , int n2 ) { if ( root == null ) { return null ; } if ( root . data == n1 root . data == n2 ) { return root ; } Node left_lca = findLCA ( root . left , n1 , n2 ) ; Node right_lca = findLCA ( root . right , n1 , n2 ) ; if ( left_lca != null && right_lca != null ) { return root ; } return ( left_lca != null ) ? left_lca : right_lca ; } public static bool printAncestors ( Node root , int target ) { if ( root == null ) { return false ; } if ( root . data == target ) { Console . Write ( root . data + " ▁ " ) ; return true ; } if ( printAncestors ( root . left , target ) || printAncestors ( root . right , target ) ) { Console . Write ( root . data + " ▁ " ) ; return true ; } return false ; } public static bool findCommonNodes ( Node root , int first , int second ) { Node LCA = findLCA ( root , first , second ) ; if ( LCA == null ) { return false ; } printAncestors ( root , LCA . data ) ; return true ; } public static void Main ( string [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; BinaryTree . root = new Node ( 1 ) ; BinaryTree . root . left = new Node ( 2 ) ; BinaryTree . root . right = new Node ( 3 ) ; BinaryTree . root . left . left = new Node ( 4 ) ; BinaryTree . root . left . right = new Node ( 5 ) ; BinaryTree . root . right . left = new Node ( 6 ) ; BinaryTree . root . right . right = new Node ( 7 ) ; BinaryTree . root . left . left . left = new Node ( 8 ) ; BinaryTree . root . right . left . left = new Node ( 9 ) ; BinaryTree . root . right . left . right = new Node ( 10 ) ; if ( findCommonNodes ( root , 9 , 7 ) == false ) { Console . WriteLine ( " No ▁ Common ▁ nodes " ) ; } } }
Print Postorder traversal from given Inorder and Preorder traversals | C # program to print Postorder traversal from given Inorder and Preorder traversals . ; Find index of next item in preorder traversal in inorder . ; traverse left tree ; traverse right tree ; print root node at the end of traversal ; Driver code
using System ; class GFG { public static int preIndex = 0 ; public virtual void printPost ( int [ ] arr , int [ ] pre , int inStrt , int inEnd ) { if ( inStrt > inEnd ) { return ; } int inIndex = search ( arr , inStrt , inEnd , pre [ preIndex ++ ] ) ; printPost ( arr , pre , inStrt , inIndex - 1 ) ; printPost ( arr , pre , inIndex + 1 , inEnd ) ; Console . Write ( arr [ inIndex ] + " ▁ " ) ; } public virtual int search ( int [ ] arr , int startIn , int endIn , int data ) { int i = 0 ; for ( i = startIn ; i < endIn ; i ++ ) { if ( arr [ i ] == data ) { return i ; } } return i ; } public static void Main ( string [ ] ars ) { int [ ] arr = new int [ ] { 4 , 2 , 5 , 1 , 3 , 6 } ; int [ ] pre = new int [ ] { 1 , 2 , 4 , 5 , 3 , 6 } ; int len = arr . Length ; GFG tree = new GFG ( ) ; tree . printPost ( arr , pre , 0 , len - 1 ) ; } }
Binary Tree | Set 1 ( Introduction ) | Class containing left and right child of current node and key value
class Node { int key ; Node left , right ; public Node ( int item ) { key = item ; left = right = null ; } }
Maximum difference between node and its ancestor in Binary Tree | C # program to find maximum difference between node and its ancestor ; A binary tree node has key , pointer to left and right child ; Class Res created to implement pass by reference of ' res ' variable ; Recursive function to calculate maximum ancestor - node difference in binary tree . It updates value at ' res ' to store the result . The returned value of this function is minimum value in subtree rooted with ' t ' ; Returning Maximum int value if node is not there ( one child case ) ; If leaf node then just return node 's value  ; Recursively calling left and right subtree for minimum value ; Updating res if ( node value - minimum value from subtree ) is bigger than res ; Returning minimum value got so far ; This function mainly calls maxDiffUtil ( ) ; Initialising result with minimum int value ; Helper function to print inorder traversal of binary tree ; Driver program to test the above functions ; Making above given diagram 's binary tree
using System ; public class Node { public int key ; public Node left , right ; public Node ( int key ) { this . key = key ; left = right = null ; } } public class Res { public int r = int . MinValue ; } public class BinaryTree { public Node root ; public virtual int maxDiffUtil ( Node t , Res res ) { if ( t == null ) { return int . MaxValue ; } if ( t . left == null && t . right == null ) { return t . key ; } int val = Math . Min ( maxDiffUtil ( t . left , res ) , maxDiffUtil ( t . right , res ) ) ; res . r = Math . Max ( res . r , t . key - val ) ; return Math . Min ( val , t . key ) ; } public virtual int maxDiff ( Node root ) { Res res = new Res ( ) ; maxDiffUtil ( root , res ) ; return res . r ; } public virtual void inorder ( Node root ) { if ( root != null ) { inorder ( root . left ) ; Console . Write ( root . key + " " ) ; inorder ( root . right ) ; } } public static void Main ( string [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 8 ) ; tree . root . left = new Node ( 3 ) ; tree . root . left . left = new Node ( 1 ) ; tree . root . left . right = new Node ( 6 ) ; tree . root . left . right . left = new Node ( 4 ) ; tree . root . left . right . right = new Node ( 7 ) ; tree . root . right = new Node ( 10 ) ; tree . root . right . right = new Node ( 14 ) ; tree . root . right . right . left = new Node ( 13 ) ; Console . WriteLine ( " Maximum ▁ difference ▁ between ▁ a ▁ node ▁ and " + " ▁ its ▁ ancestor ▁ is ▁ : ▁ " + tree . maxDiff ( tree . root ) ) ; } }
Query for ancestor | C # program to query whether two node has ancestor - descendant relationship or not ; Utility dfs method to assign in and out time to each node ; Assign In - time to node u ; Call dfs over all neighbors except parent ; Assign Out - time to node u ; Method to preprocess all nodes for assigning time ; Construct array of vector data structure for tree ; Call dfs method from root ; Method returns " yes " if u is a ancestor node of v ; Driver code
using System ; using System . Collections ; class GFG { static void dfs ( ArrayList [ ] g , int u , int parent , int [ ] timeIn , int [ ] timeOut , ref int cnt ) { timeIn [ u ] = cnt ++ ; for ( int i = 0 ; i < g [ u ] . Count ; i ++ ) { int v = ( int ) g [ u ] [ i ] ; if ( v != parent ) dfs ( g , v , u , timeIn , timeOut , ref cnt ) ; } timeOut [ u ] = cnt ++ ; } static void preProcess ( int [ , ] edges , int V , int [ ] timeIn , int [ ] timeOut ) { ArrayList [ ] g = new ArrayList [ V ] ; for ( int i = 0 ; i < V ; i ++ ) { g [ i ] = new ArrayList ( ) ; } for ( int i = 0 ; i < V - 1 ; i ++ ) { int u = edges [ i , 0 ] ; int v = edges [ i , 1 ] ; g [ u ] . Add ( v ) ; g [ v ] . Add ( u ) ; } int cnt = 0 ; dfs ( g , 0 , - 1 , timeIn , timeOut , ref cnt ) ; } static string isAncestor ( int u , int v , int [ ] timeIn , int [ ] timeOut ) { bool b = ( timeIn [ u ] <= timeIn [ v ] && timeOut [ v ] <= timeOut [ u ] ) ; return ( b ? " yes " : " no " ) ; } static void Main ( ) { int [ , ] edges = { { 0 , 1 } , { 0 , 2 } , { 1 , 3 } , { 1 , 4 } , { 2 , 5 } , { 4 , 6 } , { 5 , 7 } } ; int E = edges . GetLength ( 0 ) ; int V = E + 1 ; int [ ] timeIn = new int [ V ] ; int [ ] timeOut = new int [ V ] ; preProcess ( edges , V , timeIn , timeOut ) ; int u = 1 ; int v = 6 ; Console . Write ( isAncestor ( u , v , timeIn , timeOut ) + " STRNEWLINE " ) ; u = 1 ; v = 7 ; Console . Write ( isAncestor ( u , v , timeIn , timeOut ) + " STRNEWLINE " ) ; } }
Print path from root to a given node in a binary tree | C # implementation to print the path from root to a given node in a binary tree ; A node of binary tree ; Returns true if there is a path from root to the given node . It also populates ' arr ' with the given path ; if root is NULL there is no path ; push the node ' s ▁ value ▁ in ▁ ' arr '  ; if it is the required node return true ; else check whether the required node lies in the left subtree or right subtree of the current node ; required node does not lie either in the left or right subtree of the current node Thus , remove current node ' s ▁ value ▁ from ▁ ▁ ▁ ' arr 'and then return false  ; function to print the path from root to the given node if the node lies in the binary tree ; List to store the path ; if required node ' x ' is present then print the path ; ' x ' is not present in the binary tree ; Driver code ; binary tree formation
using System ; using System . Collections ; using System . Collections . Generic ; class PrintPath { public class Node { public int data ; public Node left , right ; public Node ( int data ) { this . data = data ; left = right = null ; } } public static Boolean hasPath ( Node root , List < int > arr , int x ) { if ( root == null ) return false ; arr . Add ( root . data ) ; if ( root . data == x ) return true ; if ( hasPath ( root . left , arr , x ) || hasPath ( root . right , arr , x ) ) return true ; arr . RemoveAt ( arr . Count - 1 ) ; return false ; } public static void printPath ( Node root , int x ) { List < int > arr = new List < int > ( ) ; if ( hasPath ( root , arr , x ) ) { for ( int i = 0 ; i < arr . Count - 1 ; i ++ ) Console . Write ( arr [ i ] + " - > " ) ; Console . Write ( arr [ arr . Count - 1 ] ) ; } else Console . Write ( " No ▁ Path " ) ; } public static void Main ( String [ ] args ) { Node root = new Node ( 1 ) ; root . left = new Node ( 2 ) ; root . right = new Node ( 3 ) ; root . left . left = new Node ( 4 ) ; root . left . right = new Node ( 5 ) ; root . right . left = new Node ( 6 ) ; root . right . right = new Node ( 7 ) ; int x = 5 ; printPath ( root , x ) ; } }
Print Ancestors of a given node in Binary Tree | C # program to print ancestors of given node ; A binary tree node has data , pointer to left child and a pointer to right child ; If target is present in tree , then prints the ancestors and returns true , otherwise returns false . ; base cases ; If target is present in either left or right subtree of this node , then print this node ; Else return false ; Driver program to test above functions ; Construct the following binary tree 1 / \ 2 3 / \ 4 5 / 7
using System ; public class Node { public int data ; public Node left , right , nextRight ; public Node ( int item ) { data = item ; left = right = nextRight = null ; } } public class BinaryTree { public Node root ; public virtual bool printAncestors ( Node node , int target ) { if ( node == null ) { return false ; } if ( node . data == target ) { return true ; } if ( printAncestors ( node . left , target ) || printAncestors ( node . right , target ) ) { Console . Write ( node . data + " ▁ " ) ; return true ; } return false ; } public static void Main ( string [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 1 ) ; tree . root . left = new Node ( 2 ) ; tree . root . right = new Node ( 3 ) ; tree . root . left . left = new Node ( 4 ) ; tree . root . left . right = new Node ( 5 ) ; tree . root . left . left . left = new Node ( 7 ) ; tree . printAncestors ( tree . root , 7 ) ; } }
Kth ancestor of a node in binary tree | Set 2 | C # program to calculate Kth ancestor of given node ; A Binary Tree Node ; temporary node to keep track of Node returned from previous recursive call during backtrack ; recursive function to calculate Kth ancestor ; Base case ; print the kth ancestor ; return null to stop further backtracking ; return current node to previous call ; Utility function to create a new tree node ; Driver code ; print kth ancestor of given node ; check if parent is not null , it means there is no Kth ancestor of the node
using System ; class GFG { public class Node { public int data ; public Node left , right ; } ; static Node temp = null ; static int k ; static Node kthAncestorDFS ( Node root , int node ) { if ( root == null ) return null ; if ( root . data == node || ( temp = kthAncestorDFS ( root . left , node ) ) != null || ( temp = kthAncestorDFS ( root . right , node ) ) != null ) { if ( k > 0 ) k -- ; else if ( k == 0 ) { Console . Write ( " Kth ▁ ancestor ▁ is : ▁ " + root . data ) ; return null ; } return root ; } return null ; } static Node newNode ( int data ) { Node temp = new Node ( ) ; temp . data = data ; temp . left = temp . right = null ; return temp ; } public static void Main ( String [ ] args ) { Node root = newNode ( 1 ) ; root . left = newNode ( 2 ) ; root . right = newNode ( 3 ) ; root . left . left = newNode ( 4 ) ; root . left . right = newNode ( 5 ) ; k = 2 ; int node = 5 ; Node parent = kthAncestorDFS ( root , node ) ; if ( parent != null ) Console . WriteLine ( " - 1" ) ; } }
Succinct Encoding of Binary Tree | C # program to demonstrate Succinct Tree Encoding and decoding ; A Binary Tree Node ; Utility function to create new Node ; This function fills lists ' struc ' and ' data ' . ' struc ' list stores structure information . ' data ' list stores tree data ; If root is null , put 0 in structure array and return ; Else place 1 in structure array , key in ' data ' array and recur for left and right children ; Constructs tree from ' struc ' and ' data ' ; Remove one item from structure list ; If removed bit is 1 , ; Remove an item from data list ; Create a tree node with the removed data ; And recur to create left and right subtrees ; A utility function to print tree ; Driver code ; Let us conthe Tree shown in the above figure ; Structure iterator ; Data iterator
using System ; using System . Collections . Generic ; class GFG { public class Node { public int key ; public Node left , right ; } ; static Node newNode ( int key ) { Node temp = new Node ( ) ; temp . key = key ; temp . left = temp . right = null ; return ( temp ) ; } static List < Boolean > struc ; static List < int > data ; static Node root ; static void EncodeSuccinct ( Node root ) { if ( root == null ) { struc . Add ( false ) ; return ; } struc . Add ( true ) ; data . Add ( root . key ) ; EncodeSuccinct ( root . left ) ; EncodeSuccinct ( root . right ) ; } static Node DecodeSuccinct ( ) { if ( struc . Count <= 0 ) return null ; bool b = struc [ 0 ] ; struc . RemoveAt ( 0 ) ; if ( b == true ) { int key = data [ 0 ] ; data . Remove ( 0 ) ; Node root = newNode ( key ) ; root . left = DecodeSuccinct ( ) ; root . right = DecodeSuccinct ( ) ; return root ; } return null ; } static void preorder ( Node root ) { if ( root != null ) { Console . Write ( " key : ▁ " + root . key ) ; if ( root . left != null ) Console . Write ( " ▁ left ▁ child : ▁ " + root . left . key ) ; if ( root . right != null ) Console . Write ( " ▁ right ▁ child : ▁ " + root . right . key ) ; Console . WriteLine ( ) ; preorder ( root . left ) ; preorder ( root . right ) ; } } public static void Main ( String [ ] args ) { Node root = newNode ( 10 ) ; root . left = newNode ( 20 ) ; root . right = newNode ( 30 ) ; root . left . left = newNode ( 40 ) ; root . left . right = newNode ( 50 ) ; root . right . right = newNode ( 70 ) ; Console . Write ( " Given ▁ Tree STRNEWLINE " ) ; preorder ( root ) ; struc = new List < Boolean > ( ) ; data = new List < int > ( ) ; EncodeSuccinct ( root ) ; Console . Write ( " STRNEWLINE Encoded ▁ Tree STRNEWLINE " ) ; Console . Write ( " Structure ▁ List STRNEWLINE " ) ; foreach ( bool si in struc ) { if ( si == true ) Console . Write ( 1 + " ▁ " ) ; else Console . Write ( 0 + " ▁ " ) ; } Console . Write ( " STRNEWLINE Data ▁ List STRNEWLINE " ) ; foreach ( int di in data ) Console . Write ( di + " ▁ " ) ; Node newroot = DecodeSuccinct ( ) ; Console . Write ( " STRNEWLINE STRNEWLINE Preorder ▁ traversal " + " of ▁ decoded ▁ tree STRNEWLINE " ) ; preorder ( newroot ) ; } }