dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; public class FractionalNodell { public class Node { public int data ; public Node next ; public Node ( int data ) { this . data = data ; } } static Node fractionalNodes ( Node head , int k ) { if ( k <= 0 head == null ) return null ; Node fractionalNode = null ; int i = 0 ; for ( Node temp = head ; temp != null ; temp = temp . next ) { if ( i % k == 0 ) { if ( fractionalNode == null ) fractionalNode = head ; else fractionalNode = fractionalNode . next ; } i ++ ; } return fractionalNode ; } static void printList ( Node node ) { while ( node != null ) { Console . Write ( node . data + " ▁ " ) ; node = node . next ; } Console . WriteLine ( ) ; } public static void Main ( String [ ] args ) { Node head = new Node ( 1 ) ; head . next = new Node ( 2 ) ; head . next . next = new Node ( 3 ) ; head . next . next . next = new Node ( 4 ) ; head . next . next . next . next = new Node ( 5 ) ; int k = 2 ; Console . Write ( " List ▁ is ▁ " ) ; printList ( head ) ; Node answer = fractionalNodes ( head , k ) ; Console . WriteLine ( " Fractional ▁ node ▁ is ▁ " + answer . data ) ; } }

Accumulator variables: i
Iterator variables: temp
Class/struct names: FractionalNodell, Node
C# program:
using System ; class GFG { public class Node { public int data ; public Node next ; public Node ( int data ) { this . data = data ; } } static Node modularNode ( Node head , int k ) { if ( k <= 0 head == null ) return null ; int i = 1 ; Node modularNode = null ; for ( Node temp = head ; temp != null ; temp = temp . next ) { if ( i % k == 0 ) modularNode = temp ; i ++ ; } return modularNode ; } public static void Main ( String [ ] args ) { Node head = new Node ( 1 ) ; head . next = new Node ( 2 ) ; head . next . next = new Node ( 3 ) ; head . next . next . next = new Node ( 4 ) ; head . next . next . next . next = new Node ( 5 ) ; int k = 2 ; Node answer = modularNode ( head , k ) ; Console . Write ( " Modular ▁ node ▁ is ▁ " ) ; if ( answer != null ) Console . WriteLine ( answer . data ) ; else Console . WriteLine ( " null " ) ; } }

Accumulator variables: i
Iterator variables: temp
Class/struct names: GFG, Node
C# program:
using System ; public class Node { public int data ; public Node left , right ; public Node ( int data ) { this . data = data ; this . left = this . right = null ; } } public class CreateBSTFromPreorder { private static Node node ; public static Node createNode ( Node node , int data ) { if ( node == null ) node = new Node ( data ) ; if ( node . data > data ) node . left = createNode ( node . left , data ) ; if ( node . data < data ) node . right = createNode ( node . right , data ) ; return node ; } public static void create ( int data ) { node = createNode ( node , data ) ; } public static void inorderRec ( Node root ) { if ( root != null ) { inorderRec ( root . left ) ; Console . WriteLine ( root . data ) ; inorderRec ( root . right ) ; } } public static void Main ( String [ ] args ) { int [ ] nodeData = { 10 , 5 , 1 , 7 , 40 , 50 } ; for ( int i = 0 ; i < nodeData . Length ; i ++ ) { create ( nodeData [ i ] ) ; } inorderRec ( node ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: CreateBSTFromPreorder, Node
C# program:
using System ; class GFG { public class Node { public int data ; public Node left ; public Node right ; } ; static Node newNode ( int data ) { Node node = new Node ( ) ; node . data = data ; node . left = null ; node . right = null ; return ( node ) ; } static Node modifytree ( Node root ) { Node right = root . right ; Node rightMost = root ; if ( root . left != null ) { rightMost = modifytree ( root . left ) ; root . right = root . left ; root . left = null ; } if ( right == null ) return rightMost ; rightMost . right = right ; rightMost = modifytree ( right ) ; return rightMost ; } static void printpre ( Node root ) { while ( root != null ) { Console . Write ( root . data + " ▁ " ) ; root = root . right ; } } public static void Main ( String [ ] args ) { Node root = newNode ( 10 ) ; root . left = newNode ( 8 ) ; root . right = newNode ( 2 ) ; root . left . left = newNode ( 3 ) ; root . left . right = newNode ( 5 ) ; modifytree ( root ) ; printpre ( root ) ; } }

Class/struct names: GFG, Node
C# program:
using System ; class GFG { public class Node { public int data ; public Node left , right ; } ; static Node getNode ( int data ) { Node newNode = new Node ( ) ; newNode . data = data ; newNode . left = newNode . right = null ; return newNode ; } static Node LevelOrder ( Node root , int data ) { if ( root == null ) { root = getNode ( data ) ; return root ; } if ( data <= root . data ) root . left = LevelOrder ( root . left , data ) ; else root . right = LevelOrder ( root . right , data ) ; return root ; } static Node constructBst ( int [ ] arr , int n ) { if ( n == 0 ) return null ; Node root = null ; for ( int i = 0 ; i < n ; i ++ ) root = LevelOrder ( root , arr [ i ] ) ; return root ; } static void inorderTraversal ( Node root ) { if ( root == null ) return ; inorderTraversal ( root . left ) ; Console . Write ( root . data + " ▁ " ) ; inorderTraversal ( root . right ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 7 , 4 , 12 , 3 , 6 , 8 , 1 , 5 , 10 } ; int n = arr . Length ; Node root = constructBst ( arr , n ) ; Console . Write ( " Inorder ▁ Traversal : ▁ " ) ; inorderTraversal ( root ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG, Node
C# program:
using System ; using System . Collections ; class GfG { public class Node { public int data ; public Node left ; public Node right ; } static Node newNode ( int data ) { Node node = new Node ( ) ; node . data = data ; node . left = null ; node . right = null ; return ( node ) ; } static void modifytree ( Node root ) { if ( root == null ) return ; Stack nodeStack = new Stack ( ) ; nodeStack . Push ( root ) ; Node pre = null ; while ( nodeStack . Count != 0 ) { Node node = ( Node ) nodeStack . Peek ( ) ; nodeStack . Pop ( ) ; if ( node . right != null ) nodeStack . Push ( node . right ) ; if ( node . left != null ) nodeStack . Push ( node . left ) ; if ( pre != null ) { pre . right = node ; } pre = node ; } } static void printpre ( Node root ) { while ( root != null ) { Console . Write ( root . data + " ▁ " ) ; root = root . right ; } } public static void Main ( String [ ] args ) { Node root = newNode ( 10 ) ; root . left = newNode ( 8 ) ; root . right = newNode ( 2 ) ; root . left . left = newNode ( 3 ) ; root . left . right = newNode ( 5 ) ; modifytree ( root ) ; printpre ( root ) ; } }

Class/struct names: GfG, Node
C# program:
using System ; class GFG { public class Node { public int key ; public Node right , left ; } ; static Node newNode ( int num ) { Node temp = new Node ( ) ; temp . key = num ; temp . left = null ; temp . right = null ; return temp ; } static Node createNLevelTree ( int [ ] arr , int n ) { Node root = newNode ( arr [ 0 ] ) ; Node temp = root ; for ( int i = 1 ; i < n ; i ++ ) { if ( temp . key > arr [ i ] ) { temp . left = newNode ( arr [ i ] ) ; temp = temp . left ; } else { temp . right = newNode ( arr [ i ] ) ; temp = temp . right ; } } return root ; } static bool isBST ( Node root , int min , int max ) { if ( root == null ) { return true ; } if ( root . key < min . key > max ) { return false ; } return ( isBST ( root . left , min , ( root . key ) - 1 ) && isBST ( root . right , ( root . key ) + 1 , max ) ) ; } static bool canRepresentNLevelBST ( int [ ] arr , int n ) { Node root = createNLevelTree ( arr , n ) ; return isBST ( root , int . MinValue , int . MaxValue ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 512 , 330 , 78 , 11 , 8 } ; int n = arr . Length ; if ( canRepresentNLevelBST ( arr , n ) ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG, Node
C# program:
using System ; public class Solution { public static void Main ( string [ ] args ) { int [ ] arr = new int [ ] { 5123 , 3300 , 783 , 1111 , 890 } ; int n = arr . Length ; int max = int . MaxValue ; int min = int . MinValue ; bool flag = true ; for ( int i = 1 ; i < n ; i ++ ) { if ( arr [ i ] > arr [ i - 1 ] && arr [ i ] > min && arr [ i ] < max ) { min = arr [ i - 1 ] ; } else if ( arr [ i ] < arr [ i - 1 ] && arr [ i ] > min && arr [ i ] < max ) { max = arr [ i - 1 ] ; } else { flag = false ; break ; } } if ( flag ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Boolean variables: flag
Class/struct names: Solution
C# program:
using System ; using System . Collections . Generic ; public class Node { public int data ; public Node left , right ; public Node ( int data ) { this . data = data ; left = right = null ; } } public class BinaryTree { public Node root ; public virtual void storeBSTNodes ( Node root , List < Node > nodes ) { if ( root == null ) { return ; } storeBSTNodes ( root . left , nodes ) ; nodes . Add ( root ) ; storeBSTNodes ( root . right , nodes ) ; } public virtual Node buildTreeUtil ( List < Node > nodes , int start , int end ) { if ( start > end ) { return null ; } int mid = ( start + end ) / 2 ; Node node = nodes [ mid ] ; node . left = buildTreeUtil ( nodes , start , mid - 1 ) ; node . right = buildTreeUtil ( nodes , mid + 1 , end ) ; return node ; } public virtual Node buildTree ( Node root ) { List < Node > nodes = new List < Node > ( ) ; storeBSTNodes ( root , nodes ) ; int n = nodes . Count ; return buildTreeUtil ( nodes , 0 , n - 1 ) ; } public virtual void preOrder ( Node node ) { if ( node == null ) { return ; } Console . Write ( node . data + " ▁ " ) ; preOrder ( node . left ) ; preOrder ( node . right ) ; } public static void Main ( string [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 10 ) ; tree . root . left = new Node ( 8 ) ; tree . root . left . left = new Node ( 7 ) ; tree . root . left . left . left = new Node ( 6 ) ; tree . root . left . left . left . left = new Node ( 5 ) ; tree . root = tree . buildTree ( tree . root ) ; Console . WriteLine ( " Preorder ▁ traversal ▁ of ▁ balanced ▁ BST ▁ is ▁ : " ) ; tree . preOrder ( tree . root ) ; } }

Index/key variables: mid
Class/struct names: BinaryTree, Node
C# program:
using System ; public class Node { public int data ; public Node left , right ; public Node ( int d ) { data = d ; left = right = null ; } } public class BinaryTree { public static Node head ; public virtual Node insert ( Node node , int data ) { if ( node == null ) { return ( new Node ( data ) ) ; } else { if ( data <= node . data ) { node . left = insert ( node . left , data ) ; } else { node . right = insert ( node . right , data ) ; } return node ; } } public virtual int minvalue ( Node node ) { Node current = node ; while ( current . left != null ) { current = current . left ; } return ( current . data ) ; } public static void Main ( string [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; Node root = null ; root = tree . insert ( root , 4 ) ; tree . insert ( root , 2 ) ; tree . insert ( root , 1 ) ; tree . insert ( root , 3 ) ; tree . insert ( root , 6 ) ; tree . insert ( root , 5 ) ; Console . WriteLine ( " Minimum ▁ value ▁ of ▁ BST ▁ is ▁ " + tree . minvalue ( root ) ) ; } }

Class/struct names: BinaryTree, Node
C# program:
using System ; using System . Collections . Generic ; class GFG { public class NodeDetails { public int data ; public int min , max ; } ; static Boolean levelOrderIsOfBST ( int [ ] arr , int n ) { if ( n == 0 ) return true ; Queue < NodeDetails > q = new Queue < NodeDetails > ( ) ; int i = 0 ; NodeDetails newNode = new NodeDetails ( ) ; newNode . data = arr [ i ++ ] ; newNode . min = int . MinValue ; newNode . max = int . MaxValue ; q . Enqueue ( newNode ) ; while ( i != n && q . Count > 0 ) { NodeDetails temp = q . Peek ( ) ; q . Dequeue ( ) ; newNode = new NodeDetails ( ) ; if ( i < n && ( arr [ i ] < ( int ) temp . data && arr [ i ] > ( int ) temp . min ) ) { newNode . data = arr [ i ++ ] ; newNode . min = temp . min ; newNode . max = temp . data ; q . Enqueue ( newNode ) ; } newNode = new NodeDetails ( ) ; if ( i < n && ( arr [ i ] > ( int ) temp . data && arr [ i ] < ( int ) temp . max ) ) { newNode . data = arr [ i ++ ] ; newNode . min = temp . data ; newNode . max = temp . max ; q . Enqueue ( newNode ) ; } } if ( i == n ) return true ; return false ; } public static void Main ( String [ ] args ) { int [ ] arr = { 7 , 4 , 12 , 3 , 6 , 8 , 1 , 5 , 10 } ; int n = arr . Length ; if ( levelOrderIsOfBST ( arr , n ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i
Class/struct names: GFG, NodeDetails
C# program:
using System ; public class Node { public char data ; public Node left , right ; public Node ( char item ) { data = item ; left = right = null ; } } class GFG { public Node root ; public static int preIndex = 0 ; public virtual Node buildTree ( char [ ] arr , char [ ] pre , int inStrt , int inEnd ) { if ( inStrt > inEnd ) { return null ; } Node tNode = new Node ( pre [ preIndex ++ ] ) ; if ( inStrt == inEnd ) { return tNode ; } int inIndex = search ( arr , inStrt , inEnd , tNode . data ) ; tNode . left = buildTree ( arr , pre , inStrt , inIndex - 1 ) ; tNode . right = buildTree ( arr , pre , inIndex + 1 , inEnd ) ; return tNode ; } public virtual int search ( char [ ] arr , int strt , int end , char value ) { int i ; for ( i = strt ; i <= end ; i ++ ) { if ( arr [ i ] == value ) { return i ; } } return i ; } public virtual void printInorder ( Node node ) { if ( node == null ) { return ; } printInorder ( node . left ) ; Console . Write ( node . data + " ▁ " ) ; printInorder ( node . right ) ; } public static void Main ( string [ ] args ) { GFG tree = new GFG ( ) ; char [ ] arr = new char [ ] { ' D ' , ' B ' , ' E ' , ' A ' , ' F ' , ' C ' } ; char [ ] pre = new char [ ] { ' A ' , ' B ' , ' D ' , ' E ' , ' C ' , ' F ' } ; int len = arr . Length ; Node root = tree . buildTree ( arr , pre , 0 , len - 1 ) ; Console . WriteLine ( " Inorder ▁ traversal ▁ of ▁ " + " constructed ▁ tree ▁ is ▁ : ▁ " ) ; tree . printInorder ( root ) ; } }

Index/key variables: i
Accumulator variables: i, preIndex
Iterator variables: i
Class/struct names: GFG, Node
C# program:
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 virtual Node lca ( Node root , int n1 , int n2 ) { while ( root != null ) { if ( root . data > n1 && root . data > n2 ) root = root . left ; else if ( root . data < n1 && root . data < n2 ) root = root . right ; else break ; } return root ; } public static void Main ( string [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 20 ) ; tree . root . left = new Node ( 8 ) ; tree . root . right = new Node ( 22 ) ; tree . root . left . left = new Node ( 4 ) ; tree . root . left . right = new Node ( 12 ) ; tree . root . left . right . left = new Node ( 10 ) ; tree . root . left . right . right = new Node ( 14 ) ; int n1 = 10 , n2 = 14 ; Node t = tree . lca ( tree . root , n1 , n2 ) ; Console . WriteLine ( " LCA ▁ of ▁ " + n1 + " ▁ and ▁ " + n2 + " ▁ is ▁ " + t . data ) ; n1 = 14 ; n2 = 8 ; t = tree . lca ( tree . root , n1 , n2 ) ; Console . WriteLine ( " LCA ▁ of ▁ " + n1 + " ▁ and ▁ " + n2 + " ▁ is ▁ " + t . data ) ; n1 = 10 ; n2 = 22 ; t = tree . lca ( tree . root , n1 , n2 ) ; Console . WriteLine ( " LCA ▁ of ▁ " + n1 + " ▁ and ▁ " + n2 + " ▁ is ▁ " + t . data ) ; } }

Class/struct names: BinaryTree, Node
C# program:
using System ; class Node { public int data ; public Node left , right ; public Node ( int x ) { data = x ; left = right = null ; } } class GFG { static int count = 0 ; public static Node insert ( Node root , int x ) { if ( root == null ) return new Node ( x ) ; if ( x < root . data ) root . left = insert ( root . left , x ) ; else if ( x > root . data ) root . right = insert ( root . right , x ) ; return root ; } public static Node kthSmallest ( Node root , int k ) { if ( root == null ) return null ; Node left = kthSmallest ( root . left , k ) ; if ( left != null ) return left ; count ++ ; if ( count == k ) return root ; return kthSmallest ( root . right , k ) ; } public static void printKthSmallest ( Node root , int k ) { count = 0 ; Node res = kthSmallest ( root , k ) ; if ( res == null ) Console . WriteLine ( " There ▁ are ▁ less ▁ " + " than ▁ k ▁ nodes ▁ in ▁ the ▁ BST " ) ; else Console . WriteLine ( " K - th ▁ Smallest " + " ▁ Element ▁ is ▁ " + res . data ) ; } public static void Main ( String [ ] args ) { Node root = null ; int [ ] keys = { 20 , 8 , 22 , 4 , 12 , 10 , 14 } ; foreach ( int x in keys ) root = insert ( root , x ) ; int k = 3 ; printKthSmallest ( root , k ) ; } }

Accumulator variables: count
Iterator variables: x
Class/struct names: GFG, Node
C# program:
using System ; public class Node { public int data ; public Node left , right ; public int lCount ; public Node ( int x ) { data = x ; left = right = null ; lCount = 0 ; } } class GFG { public static Node insert ( Node root , int x ) { if ( root == null ) return new Node ( x ) ; if ( x < root . data ) { root . left = insert ( root . left , x ) ; root . lCount ++ ; } else if ( x > root . data ) root . right = insert ( root . right , x ) ; return root ; } public static Node kthSmallest ( Node root , int k ) { if ( root == null ) return null ; int count = root . lCount + 1 ; if ( count == k ) return root ; if ( count > k ) return kthSmallest ( root . left , k ) ; return kthSmallest ( root . right , k - count ) ; } public static void Main ( String [ ] args ) { Node root = null ; int [ ] keys = { 20 , 8 , 22 , 4 , 12 , 10 , 14 } ; foreach ( int x in keys ) root = insert ( root , x ) ; int k = 4 ; Node res = kthSmallest ( root , k ) ; if ( res == null ) Console . WriteLine ( " There ▁ are ▁ less ▁ " + " than ▁ k ▁ nodes ▁ in ▁ the ▁ BST " ) ; else Console . WriteLine ( " K - th ▁ Smallest " + " ▁ Element ▁ is ▁ " + res . data ) ; } }

Accumulator variables: lCount
Iterator variables: x
Class/struct names: GFG, Node
C# program:
using System ; using System . Collections . Generic ; public class Node { public char data ; public Node left , right ; public Node ( char d ) { data = d ; left = right = null ; } } public class Tree { public static Node root ; static Dictionary < char , int > mp = new Dictionary < char , int > ( ) ; static int preIndex = 0 ; static Node buildTree ( char [ ] In , char [ ] pre , int inStrt , int inEnd ) { if ( inStrt > inEnd ) { return null ; } char curr = pre [ preIndex ++ ] ; Node tNode ; tNode = new Node ( curr ) ; if ( inStrt == inEnd ) { return tNode ; } int inIndex = mp [ curr ] ; tNode . left = buildTree ( In , pre , inStrt , inIndex - 1 ) ; tNode . right = buildTree ( In , pre , inIndex + 1 , inEnd ) ; return tNode ; } public static Node buldTreeWrap ( char [ ] In , char [ ] pre , int len ) { for ( int i = 0 ; i < len ; i ++ ) { mp . Add ( In [ i ] , i ) ; } return buildTree ( In , pre , 0 , len - 1 ) ; } static void printInorder ( Node node ) { if ( node == null ) { return ; } printInorder ( node . left ) ; Console . Write ( node . data + " ▁ " ) ; printInorder ( node . right ) ; } static public void Main ( ) { char [ ] In = { ' D ' , ' B ' , ' E ' , ' A ' , ' F ' , ' C ' } ; char [ ] pre = { ' A ' , ' B ' , ' D ' , ' E ' , ' C ' , ' F ' } ; int len = In . Length ; Tree . root = buldTreeWrap ( In , pre , len ) ; Console . WriteLine ( " Inorder ▁ traversal ▁ of ▁ the ▁ constructed ▁ tree ▁ is " ) ; printInorder ( Tree . root ) ; } }

Index/key variables: curr, i
Accumulator variables: i, preIndex
Iterator variables: i
Class/struct names: Node, Tree
C# program:
using System ; public class BinaryTree { bool hasOnlyOneChild ( int [ ] pre , int size ) { int nextDiff , lastDiff ; for ( int i = 0 ; i < size - 1 ; i ++ ) { nextDiff = pre [ i ] - pre [ i + 1 ] ; lastDiff = pre [ i ] - pre [ size - 1 ] ; if ( nextDiff * lastDiff < 0 ) { return false ; } ; } return true ; } public static void Main ( String [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; int [ ] pre = new int [ ] { 8 , 3 , 5 , 7 , 6 } ; int size = pre . Length ; if ( tree . hasOnlyOneChild ( pre , size ) == true ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: BinaryTree
C# program:
using System ; public class BinaryTree { bool hasOnlyOneChild ( int [ ] pre , int size ) { int min , max ; if ( pre [ size - 1 ] > pre [ size - 2 ] ) { max = pre [ size - 1 ] ; min = pre [ size - 2 ] ; } else { max = pre [ size - 2 ] ; min = pre [ size - 1 ] ; } for ( int i = size - 3 ; i >= 0 ; i -- ) { if ( pre [ i ] < min ) { min = pre [ i ] ; } else if ( pre [ i ] > max ) { max = pre [ i ] ; } else { return false ; } } return true ; } public static void Main ( String [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; int [ ] pre = new int [ ] { 8 , 3 , 5 , 7 , 6 } ; int size = pre . Length ; if ( tree . hasOnlyOneChild ( pre , size ) == true ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: BinaryTree
C# program:
using System ; class GfG { public class Node { public int key ; public Node left , right ; } static int KSmallestUsingMorris ( Node root , int k ) { int count = 0 ; int ksmall = int . MinValue ; Node curr = root ; while ( curr != null ) { if ( curr . left == null ) { count ++ ; if ( count == k ) ksmall = curr . key ; curr = curr . right ; } else { Node pre = curr . left ; while ( pre . right != null && pre . right != curr ) pre = pre . right ; if ( pre . right == null ) { pre . right = curr ; curr = curr . left ; } else { pre . right = null ; count ++ ; if ( count == k ) ksmall = curr . key ; curr = curr . right ; } } } return ksmall ; } static Node newNode ( int item ) { Node temp = new Node ( ) ; temp . key = item ; temp . left = null ; temp . right = null ; return temp ; } static Node insert ( Node node , int key ) { if ( node == null ) return newNode ( key ) ; if ( key < node . key ) node . left = insert ( node . left , key ) ; else if ( key > node . key ) node . right = insert ( node . right , key ) ; return node ; } public static void Main ( String [ ] args ) { Node root = null ; root = insert ( root , 50 ) ; insert ( root , 30 ) ; insert ( root , 20 ) ; insert ( root , 40 ) ; insert ( root , 70 ) ; insert ( root , 60 ) ; insert ( root , 80 ) ; for ( int k = 1 ; k <= 7 ; k ++ ) Console . Write ( KSmallestUsingMorris ( root , k ) + " ▁ " ) ; } }

Accumulator variables: count, k
Iterator variables: k
Class/struct names: GfG, Node
C# program:
using System ; class GFG { static bool isInorder ( int [ ] arr , int n ) { if ( n == 0 n == 1 ) { return true ; } for ( int i = 1 ; i < n ; i ++ ) { if ( arr [ i - 1 ] > arr [ i ] ) { return false ; } } return true ; } public static void Main ( ) { int [ ] arr = { 19 , 23 , 25 , 30 , 45 } ; int n = arr . Length ; if ( isInorder ( arr , n ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " Non " ) ; } } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG