dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { public static bool isVowel ( char c ) { string vowel = " aeiou " ; for ( int i = 0 ; i < vowel . Length ; ++ i ) { if ( vowel [ i ] == c ) { return true ; } } return false ; } public static bool printRLE ( string str , string typed ) { int n = str . Length , m = typed . Length ; int j = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( str [ i ] != typed [ j ] ) { return false ; } if ( isVowel ( str [ i ] ) == false ) { j ++ ; continue ; } int count1 = 1 ; while ( i < n - 1 && str [ i ] == str [ i + 1 ] ) { count1 ++ ; i ++ ; } int count2 = 1 ; while ( j < m - 1 && typed [ j ] == str [ i ] ) { count2 ++ ; j ++ ; } if ( count1 > count2 ) { return false ; } } return true ; } public static void Main ( string [ ] args ) { string name = " alex " , typed = " aaalaeex " ; if ( printRLE ( name , typed ) ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }

Index/key variables: i, j
Accumulator variables: count1, count2, i, j
Iterator variables: i
Class/struct names: GFG
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 Node root ; public virtual int getLevelUtil ( Node node , int data , int level ) { if ( node == null ) { return 0 ; } if ( node . data == data ) { return level ; } int downlevel = getLevelUtil ( node . left , data , level + 1 ) ; if ( downlevel != 0 ) { return downlevel ; } downlevel = getLevelUtil ( node . right , data , level + 1 ) ; return downlevel ; } public virtual int getLevel ( Node node , int data ) { return getLevelUtil ( node , data , 1 ) ; } public static void Main ( string [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 3 ) ; tree . root . left = new Node ( 2 ) ; tree . root . right = new Node ( 5 ) ; tree . root . left . left = new Node ( 1 ) ; tree . root . left . right = new Node ( 4 ) ; for ( int x = 1 ; x <= 5 ; x ++ ) { int level = tree . getLevel ( tree . root , x ) ; if ( level != 0 ) { Console . WriteLine ( " Level ▁ of ▁ " + x + " ▁ is ▁ " + tree . getLevel ( tree . root , x ) ) ; } else { Console . WriteLine ( x + " ▁ is ▁ not ▁ present ▁ in ▁ tree " ) ; } } } }

Accumulator variables: x
Iterator variables: x
Class/struct names: BinaryTree, Node
C# program:
using System ; using System . Collections . Generic ; class GFG { static String censor ( String text , String word ) { String [ ] word_list = text . Split ( ' ▁ ' ) ; String result = " " ; String stars = " " ; for ( int i = 0 ; i < word . Length ; i ++ ) stars += ' * ' ; int index = 0 ; foreach ( String i in word_list ) { if ( i . CompareTo ( word ) == 0 ) word_list [ index ] = stars ; index ++ ; } foreach ( String i in word_list ) result += i + " ▁ " ; return result ; } public static void Main ( String [ ] args ) { String extract = " GeeksforGeeks ▁ is ▁ a ▁ computer ▁ science ▁ " + " portal ▁ for ▁ geeks . ▁ I ▁ am ▁ pursuing ▁ my ▁ " + " major ▁ in ▁ computer ▁ science . ▁ " ; String cen = " computer " ; Console . WriteLine ( censor ( extract , cen ) ) ; } }

Index/key variables: index
Accumulator variables: i, index, result, stars
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int NO_OF_CHARS = 256 ; public static int getNextState ( char [ ] pat , int M , int state , int x ) { if ( state < M && ( char ) x == pat [ state ] ) { return state + 1 ; } int ns , i ; for ( ns = state ; ns > 0 ; ns -- ) { if ( pat [ ns - 1 ] == ( char ) x ) { for ( i = 0 ; i < ns - 1 ; i ++ ) { if ( pat [ i ] != pat [ state - ns + 1 + i ] ) { break ; } } if ( i == ns - 1 ) { return ns ; } } } return 0 ; } public static void computeTF ( char [ ] pat , int M , int [ ] [ ] TF ) { int state , x ; for ( state = 0 ; state <= M ; ++ state ) { for ( x = 0 ; x < NO_OF_CHARS ; ++ x ) { TF [ state ] [ x ] = getNextState ( pat , M , state , x ) ; } } } public static void search ( char [ ] pat , char [ ] txt ) { int M = pat . Length ; int N = txt . Length ; int [ ] [ ] TF = RectangularArrays . ReturnRectangularIntArray ( M + 1 , NO_OF_CHARS ) ; computeTF ( pat , M , TF ) ; int i , state = 0 ; for ( i = 0 ; i < N ; i ++ ) { state = TF [ state ] [ txt [ i ] ] ; if ( state == M ) { Console . WriteLine ( " Pattern ▁ found ▁ " + " at ▁ index ▁ " + ( i - M + 1 ) ) ; } } } public static class RectangularArrays { public static int [ ] [ ] ReturnRectangularIntArray ( int size1 , int size2 ) { int [ ] [ ] newArray = new int [ size1 ] [ ] ; for ( int array1 = 0 ; array1 < size1 ; array1 ++ ) { newArray [ array1 ] = new int [ size2 ] ; } return newArray ; } } public static void Main ( string [ ] args ) { char [ ] pat = " AABAACAADAABAAABAA " . ToCharArray ( ) ; char [ ] txt = " AABA " . ToCharArray ( ) ; search ( txt , pat ) ; } }

Index/key variables: array1, i, size1, size2, state, x
Accumulator variables: array1, i, ns
Iterator variables: array1, i, ns, state, x
Class/struct names: GFG, RectangularArrays
C# program:
using System ; class GFG { static int maxlength ( String s ) { int n = s . Length , i , j ; int ans = 0 ; for ( i = 0 ; i <= n - 1 ; i ++ ) { if ( s [ i ] == '1' ) { int count = 1 ; for ( j = i + 1 ; j <= n - 1 && s [ j ] == '1' ; j ++ ) count ++ ; ans = Math . Max ( ans , count ) ; } } return ans ; } public static void Main ( String [ ] args ) { String s = "11101110" ; Console . Write ( maxlength ( s ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void generateLetters ( string S , int P , Dictionary < char , char > M ) { if ( P == S . Length ) { Console . WriteLine ( S ) ; return ; } generateLetters ( S , P + 1 , M ) ; S = S . Substring ( 0 , P ) + M [ S [ P ] ] + S . Substring ( P + 1 ) ; generateLetters ( S , P + 1 , M ) ; return ; } public static void Main ( ) { string S = " aBc " ; Dictionary < char , char > M = new Dictionary < char , char > ( ) ; M . Add ( ' a ' , ' $ ' ) ; M . Add ( ' B ' , ' # ' ) ; M . Add ( ' c ' , ' ^ ' ) ; M . Add ( ' d ' , ' & ' ) ; M . Add ( '1' , ' * ' ) ; M . Add ( '2' , ' ! ' ) ; M . Add ( ' E ' , ' @ ' ) ; generateLetters ( S , 0 , M ) ; } }

Index/key variables: P
Class/struct names: GFG
C# program:
using System ; public class GFG { static int ansSwaps ; static bool check ( char [ ] S ) { for ( int i = 1 ; i < S . Length ; i ++ ) { if ( S [ i - 1 ] == S [ i ] ) { return false ; } } return true ; } static void minimumSwaps ( char [ ] S , int swaps , int idx ) { if ( check ( S ) ) { ansSwaps = Math . Min ( ansSwaps , swaps ) ; } for ( int i = idx ; i < S . Length ; i ++ ) { for ( int j = i + 1 ; j < S . Length ; j ++ ) { swap ( S , i , j ) ; minimumSwaps ( S , swaps + 1 , i + 1 ) ; S = swap ( S , i , j ) ; } } } static char [ ] swap ( char [ ] arr , int i , int j ) { char temp = arr [ i ] ; arr [ i ] = arr [ j ] ; arr [ j ] = temp ; return arr ; } static void findMinimumSwaps ( char [ ] S ) { ansSwaps = int . MaxValue ; minimumSwaps ( S , 0 , 0 ) ; if ( ansSwaps == int . MaxValue ) Console . Write ( " - 1" ) ; else Console . Write ( ansSwaps ) ; } public static void Main ( String [ ] args ) { String S = " ABAACD " ; findMinimumSwaps ( S . ToCharArray ( ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static void countOsBetween1s ( String S , int N , int [ , ] Q ) { int [ ] leftBound = new int [ N ] ; int [ ] rightBound = new int [ N ] ; int count = 0 ; int total = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( S [ i ] == '1' ) { count = total ; } else if ( S [ i ] == '0' ) { total ++ ; } rightBound [ i ] = count ; } count = 0 ; total = 0 ; for ( int i = N - 1 ; i >= 0 ; i -- ) { if ( S [ i ] == '1' ) { count = total ; } else if ( S [ i ] == '0' ) { total ++ ; } leftBound [ i ] = count ; } for ( int q = 0 ; q < Q . GetLength ( 0 ) ; q ++ ) { int L = Q [ q , 0 ] ; int R = Q [ q , 1 ] ; count = leftBound [ L ] + rightBound [ R ] - total ; Console . Write ( count + " ▁ " ) ; } } public static void Main ( String [ ] args ) { String S = "1001010" ; int [ , ] Q = { { 0 , 4 } , { 0 , 5 } } ; int N = S . Length ; countOsBetween1s ( S , N , Q ) ; } }

Index/key variables: L, N, R, i
Accumulator variables: i, q, total
Iterator variables: i, q
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { public class node { public int data ; public node left , right ; public node ( int data ) { this . data = data ; this . left = this . right = null ; } } static int getLevel ( node root , int data ) { Queue < node > q = new Queue < node > ( ) ; int level = 1 ; q . Enqueue ( root ) ; q . Enqueue ( null ) ; while ( q . Count > 0 ) { node temp = q . Dequeue ( ) ; if ( temp == null ) { if ( q . Count > 0 ) { q . Enqueue ( null ) ; } level += 1 ; } else { if ( temp . data == data ) { return level ; } if ( temp . left != null ) { q . Enqueue ( temp . left ) ; } if ( temp . right != null ) { q . Enqueue ( temp . right ) ; } } } return 0 ; } public static void Main ( String [ ] args ) { node root = new node ( 20 ) ; root . left = new node ( 10 ) ; root . right = new node ( 30 ) ; root . left . left = new node ( 5 ) ; root . left . right = new node ( 15 ) ; root . left . right . left = new node ( 12 ) ; root . right . left = new node ( 25 ) ; root . right . right = new node ( 40 ) ; int level = getLevel ( root , 30 ) ; if ( level != 0 ) Console . WriteLine ( " level ▁ of ▁ node ▁ 30 ▁ is ▁ " + level ) ; else Console . WriteLine ( " node ▁ 30 ▁ not ▁ found " ) ; level = getLevel ( root , 12 ) ; if ( level != 0 ) Console . WriteLine ( " level ▁ of ▁ node ▁ 12 ▁ is ▁ " + level ) ; else Console . WriteLine ( " node ▁ 12 ▁ not ▁ found " ) ; level = getLevel ( root , 25 ) ; if ( level != 0 ) Console . WriteLine ( " level ▁ of ▁ node ▁ 25 ▁ is ▁ " + level ) ; else Console . WriteLine ( " node ▁ 25 ▁ not ▁ found " ) ; level = getLevel ( root , 27 ) ; if ( level != 0 ) Console . WriteLine ( " level ▁ of ▁ node ▁ 27 ▁ is ▁ " + level ) ; else Console . WriteLine ( " node ▁ 27 ▁ not ▁ found " ) ; } }

Accumulator variables: level
Class/struct names: GFG, node
C# program:
using System ; public class GFG { static String finalAns = " " ; class Node { public char data ; public Node left , right ; } ; static Node newNode ( char data ) { Node temp = new Node ( ) ; temp . data = data ; temp . left = temp . right = null ; return temp ; } static bool checkPalindrome ( String s ) { int low = 0 , high = ( int ) s . Length - 1 ; while ( low < high ) { if ( s [ low ] != s [ high ] ) return false ; low ++ ; high -- ; } return true ; } static void lexicographicallySmall ( Node root , String s ) { if ( root == null ) return ; s += root . data ; if ( root . left == null && root . right == null ) { if ( checkPalindrome ( s ) ) { if ( finalAns == " $ " ) finalAns = s ; else finalAns = finalAns . CompareTo ( s ) <= 0 ? finalAns : s ; } return ; } lexicographicallySmall ( root . left , s ) ; lexicographicallySmall ( root . right , s ) ; } static void getPalindromePath ( Node root ) { finalAns = " $ " ; lexicographicallySmall ( root , " " ) ; if ( finalAns == " $ " ) Console . Write ( " No ▁ Palindromic ▁ Path ▁ exists " ) ; else Console . Write ( finalAns ) ; } public static void Main ( String [ ] args ) { Node root = newNode ( ' a ' ) ; root . left = newNode ( ' c ' ) ; root . left . left = newNode ( ' a ' ) ; root . left . right = newNode ( ' g ' ) ; root . right = newNode ( ' b ' ) ; root . right . left = newNode ( ' b ' ) ; root . right . right = newNode ( ' x ' ) ; root . right . left . right = newNode ( ' a ' ) ; getPalindromePath ( root ) ; } }

Index/key variables: high, low
Accumulator variables: high, low, s
Class/struct names: GFG, Node
C# program:
using System ; class GfG { class Node { public int key ; public Node left , right ; } static Node newNode ( int key ) { Node n = new Node ( ) ; n . key = key ; n . left = null ; n . right = null ; return n ; } static int findMirrorRec ( int target , Node left , Node right ) { if ( left == null right == null ) return 0 ; if ( left . key == target ) return right . key ; if ( right . key == target ) return left . key ; int mirror_val = findMirrorRec ( target , left . left , right . right ) ; if ( mirror_val != 0 ) return mirror_val ; return findMirrorRec ( target , left . right , right . left ) ; } static int findMirror ( Node root , int target ) { if ( root == null ) return 0 ; if ( root . key == target ) return target ; return findMirrorRec ( target , root . left , root . right ) ; } public static void Main ( String [ ] args ) { Node root = newNode ( 1 ) ; root . left = newNode ( 2 ) ; root . left . left = newNode ( 4 ) ; root . left . left . right = newNode ( 7 ) ; root . right = newNode ( 3 ) ; root . right . left = newNode ( 5 ) ; root . right . right = newNode ( 6 ) ; root . right . left . left = newNode ( 8 ) ; root . right . left . right = newNode ( 9 ) ; int target = root . left . left . key ; int mirror = findMirror ( root , target ) ; if ( mirror != 0 ) Console . WriteLine ( " Mirror ▁ of ▁ Node ▁ " + target + " ▁ is ▁ Node ▁ " + mirror ) ; else Console . WriteLine ( " Mirror ▁ of ▁ Node ▁ " + target + " ▁ is ▁ null ▁ " ) ; } }

Class/struct names: GfG, Node
C# program:
using System ; using System . Collections . Generic ; class GFG { public const int MaxValue = 2147483647 ; static bool balanced ( int [ ] small , int [ ] caps ) { for ( int i = 0 ; i < 26 ; i ++ ) { if ( small [ i ] != 0 && ( caps [ i ] == 0 ) ) return false ; else if ( ( small [ i ] == 0 ) && ( caps [ i ] != 0 ) ) return false ; } return true ; } static void smallestBalancedSubstring ( string s ) { int [ ] small = new int [ 26 ] ; int i ; int [ ] caps = new int [ 26 ] ; Array . Clear ( small , 0 , small . Length ) ; Array . Clear ( caps , 0 , caps . Length ) ; for ( i = 0 ; i < s . Length ; i ++ ) { if ( s [ i ] >= 65 && s [ i ] <= 90 ) caps [ ( int ) s [ i ] - 65 ] ++ ; else small [ ( int ) s [ i ] - 97 ] ++ ; } Dictionary < char , int > mp = new Dictionary < char , int > ( ) ; for ( i = 0 ; i < 26 ; i ++ ) { if ( small [ i ] != 0 && caps [ i ] == 0 ) { mp [ ( char ) ( i + 97 ) ] = 1 ; } else if ( caps [ i ] != 0 && small [ i ] == 0 ) mp [ ( char ) ( i + 65 ) ] = 1 ; } Array . Clear ( small , 0 , small . Length ) ; Array . Clear ( caps , 0 , caps . Length ) ; i = 0 ; int st = 0 ; int start = - 1 , end = - 1 ; int minm = MaxValue ; while ( i < s . Length ) { if ( mp . ContainsKey ( s [ i ] ) ) { while ( st < i ) { if ( ( int ) s [ st ] >= 65 && ( int ) s [ st ] <= 90 ) caps [ ( int ) s [ st ] - 65 ] -- ; else small [ ( int ) s [ st ] - 97 ] -- ; st ++ ; } i += 1 ; st = i ; } else { if ( ( int ) s [ i ] >= 65 && ( int ) s [ i ] <= 90 ) caps [ ( int ) s [ i ] - 65 ] ++ ; else small [ ( int ) s [ i ] - 97 ] ++ ; while ( true ) { if ( ( int ) s [ st ] >= 65 && ( int ) s [ st ] <= 90 && caps [ ( int ) s [ st ] - 65 ] > 1 ) { caps [ ( int ) s [ st ] - 65 ] -- ; st ++ ; } else if ( ( int ) s [ st ] >= 97 && ( int ) s [ st ] <= 122 && small [ ( int ) s [ st ] - 97 ] > 1 ) { small [ ( int ) s [ st ] - 97 ] -- ; st ++ ; } else break ; } if ( balanced ( small , caps ) ) { if ( minm > ( i - st + 1 ) ) { minm = i - st + 1 ; start = st ; end = i ; } } i += 1 ; } } if ( start == - 1 end == - 1 ) Console . WriteLine ( - 1 ) ; else { string ans = " " ; for ( int j = start ; j <= end ; j ++ ) ans += s [ j ] ; Console . WriteLine ( ans ) ; } } public static void Main ( ) { string s = " azABaabba " ; smallestBalancedSubstring ( s ) ; } }

Index/key variables: i, j, st
Accumulator variables: ans, i, j, st
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { public class TrieNode { public TrieNode [ ] child = new TrieNode [ 256 ] ; public TrieNode ( ) { } } ; public static void insertTrie ( TrieNode root , String str ) { int M = str . Length ; for ( int i = 0 ; i < M ; i ++ ) { if ( root . child [ str [ i ] ] == null ) { root . child [ str [ i ] ] = new TrieNode ( ) ; } root = root . child [ str [ i ] ] ; } } public static int findStrLen ( TrieNode root , String str ) { int M = str . Length ; int len = 0 ; for ( int i = 0 ; i < M ; i ++ ) { if ( root . child [ str [ i ] ] != null ) { len ++ ; root = root . child [ str [ i ] ] ; } else { return len ; } } return len ; } public static void findMaxLenPair ( List < string > arr , int N ) { int idx = - 1 ; int len = 0 ; TrieNode root = new TrieNode ( ) ; insertTrie ( root , arr [ 0 ] ) ; for ( int i = 1 ; i < N ; i ++ ) { int temp = findStrLen ( root , arr [ i ] ) ; if ( temp > len ) { len = temp ; idx = i ; } insertTrie ( root , arr [ i ] ) ; } for ( int i = 0 ; i < N ; i ++ ) { int M = arr [ i ] . Length ; if ( i != idx && M >= len ) { bool found = true ; for ( int j = 0 ; j < len ; j ++ ) { if ( arr [ i ] [ j ] != arr [ idx ] [ j ] ) { found = false ; break ; } } if ( found ) { Console . WriteLine ( " ( " + arr [ i ] + " , ▁ " + arr [ idx ] + " ) " ) ; return ; } } } } public static void Main ( ) { List < string > arr = new List < string > ( ) { " geeksforgeeks " , " geeks " , " geeksforcse " } ; int N = arr . Count ; findMaxLenPair ( arr , N ) ; } }

Index/key variables: i, idx, j
Accumulator variables: i, j, len
Iterator variables: i, j
Boolean variables: found
Class/struct names: GFG, TrieNode
C# program:
using System ; using System . Collections . Generic ; class GFG { static void transformString ( string str1 , string str2 ) { int N = str1 . Length ; List < List < int > > convChar = new List < List < int > > ( ) ; List < List < int > > str1array = new List < List < int > > ( ) ; for ( int i = 0 ; i < 26 ; i ++ ) { convChar . Add ( new List < int > ( ) ) ; str1array . Add ( new List < int > ( ) ) ; } Dictionary < int , char > convertMap = new Dictionary < int , char > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { str1array [ str1 [ i ] - ' a ' ] . Add ( i ) ; } for ( int i = 0 ; i < N ; i ++ ) { if ( str1 [ i ] < str2 [ i ] ) { Console . WriteLine ( - 1 ) ; return ; } else if ( str1 [ i ] == str2 [ i ] ) continue ; else { convChar [ str2 [ i ] - ' a ' ] . Add ( i ) ; convertMap [ i ] = str2 [ i ] ; } } int ret = 0 ; List < List < int > > retv = new List < List < int > > ( ) ; for ( int i = 25 ; i >= 0 ; i -- ) { List < int > v = convChar [ i ] ; if ( v . Count == 0 ) continue ; ret ++ ; List < int > v1 = str1array [ i ] ; if ( v1 . Count == 0 ) { Console . WriteLine ( - 1 ) ; return ; } bool isScompleted = false ; for ( int j = 0 ; j < v1 . Count ; j ++ ) { if ( convertMap . ContainsKey ( v1 [ j ] ) ) { char a = convertMap [ v1 [ j ] ] ; if ( a > i + ' a ' ) continue ; else { v . Add ( v1 [ j ] ) ; isScompleted = true ; retv . Add ( v ) ; break ; } } else { v . Add ( v1 [ j ] ) ; isScompleted = true ; retv . Add ( v ) ; break ; } } if ( ! isScompleted ) { Console . WriteLine ( - 1 ) ; return ; } } Console . WriteLine ( ret ) ; } static void Main ( ) { string A = " abcab " ; string B = " aabab " ; transformString ( A , B ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, ret
Iterator variables: i, j
Boolean variables: isScompleted
Class/struct names: GFG
C# program:
using System ; class GFG { public class Node { public int data ; public Node left , right ; } ; static Node newNode ( int data ) { Node node = new Node ( ) ; node . data = data ; node . left = node . right = null ; return ( node ) ; } static int maxSize ; static Node maxNode ; public class pair { public int first ; public string second ; public pair ( int a , string b ) { first = a ; second = b ; } } static pair largestSubtreeUtil ( Node root , string str ) { if ( root == null ) return new pair ( 0 , str ) ; string left = " " , right = " " ; pair ls1 = largestSubtreeUtil ( root . left , left ) ; left = ls1 . second ; int ls = ls1 . first ; pair rs1 = largestSubtreeUtil ( root . right , right ) ; right = rs1 . second ; int rs = rs1 . first ; int size = ls + rs + 1 ; if ( left . Equals ( right ) ) { if ( size > maxSize ) { maxSize = size ; maxNode = root ; } } str += " | " + left + " | " ; str += " | " + root . data + " | " ; str += " | " + right + " | " ; return new pair ( size , str ) ; } static int largestSubtree ( Node node ) { maxSize = 0 ; largestSubtreeUtil ( node , " " ) ; return maxSize ; } public static void Main ( string [ ] args ) { Node root = newNode ( 50 ) ; root . left = newNode ( 10 ) ; root . right = newNode ( 60 ) ; root . left . left = newNode ( 5 ) ; root . left . right = newNode ( 20 ) ; root . right . left = newNode ( 70 ) ; root . right . left . left = newNode ( 65 ) ; root . right . left . right = newNode ( 80 ) ; root . right . right = newNode ( 70 ) ; root . right . right . left = newNode ( 65 ) ; root . right . right . right = newNode ( 80 ) ; maxNode = null ; maxSize = largestSubtree ( root ) ; Console . Write ( " Largest ▁ Subtree ▁ is ▁ rooted ▁ at ▁ node ▁ " + maxNode . data + " and size is " } }

Accumulator variables: str
Class/struct names: GFG, Node, pair
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool isScramble ( string S1 , string S2 ) { if ( S1 . Length != S2 . Length ) { return false ; } int n = S1 . Length ; if ( n == 0 ) { return true ; } if ( S1 . Equals ( S2 ) ) { return true ; } char [ ] tempArray1 = S1 . ToCharArray ( ) ; char [ ] tempArray2 = S2 . ToCharArray ( ) ; Array . Sort ( tempArray1 ) ; Array . Sort ( tempArray2 ) ; string copy_S1 = new string ( tempArray1 ) ; string copy_S2 = new string ( tempArray2 ) ; if ( ! copy_S1 . Equals ( copy_S2 ) ) { return false ; } for ( int i = 1 ; i < n ; i ++ ) { if ( isScramble ( S1 . Substring ( 0 , i ) , S2 . Substring ( 0 , i ) ) && isScramble ( S1 . Substring ( i , n - i ) , S2 . Substring ( i , n - i ) ) ) { return true ; } if ( isScramble ( S1 . Substring ( 0 , i ) , S2 . Substring ( n - i , i ) ) && isScramble ( S1 . Substring ( i , n - i ) , S2 . Substring ( 0 , n - i ) ) ) { return true ; } } return false ; } static void Main ( ) { string S1 = " coder " ; string S2 = " ocred " ; if ( isScramble ( S1 , S2 ) ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static String findAns ( String s ) { int digit ; List < int > odd = new List < int > ( ) ; List < int > even = new List < int > ( ) ; foreach ( char c in s . ToCharArray ( ) ) { digit = c - '0' ; if ( digit % 2 == 1 ) odd . Add ( digit ) ; else even . Add ( digit ) ; } int i = 0 ; int j = 0 ; String ans = " " ; while ( i < odd . Count && j < even . Count ) { if ( odd [ i ] < even [ j ] ) ans += ( char ) ( odd [ i ++ ] + '0' ) ; else ans += ( char ) ( even [ j ++ ] + '0' ) ; } while ( i < odd . Count ) ans += ( char ) ( odd [ i ++ ] + '0' ) ; while ( j < even . Count ) ans += ( char ) ( even [ j ++ ] + '0' ) ; while ( ans [ 0 ] == '0' ) { ans = ans . Substring ( 1 ) ; } return ans ; } public static void Main ( String [ ] args ) { String s = "894687536" ; Console . Write ( findAns ( s ) ) ; } }

Index/key variables: i, j
Accumulator variables: ans, i, j
Iterator variables: c
Class/struct names: GFG
C# program:
using System ; class GFG { public static int bcdToDecimal ( String s ) { int len = s . Length ; int check = 0 , check0 = 0 ; int num = 0 , sum = 0 ; int mul = 1 , rev = 0 ; for ( int i = len - 1 ; i >= 0 ; i -- ) { sum += ( s [ i ] - '0' ) * mul ; mul *= 2 ; check ++ ; if ( check == 4 i == 0 ) { if ( sum == 0 && check0 == 0 ) { num = 1 ; check0 = 1 ; } else { num = num * 10 + sum ; } check = 0 ; sum = 0 ; mul = 1 ; } } while ( num > 0 ) { rev = rev * 10 + ( num % 10 ) ; num /= 10 ; } if ( check0 == 1 ) return rev - 1 ; return rev ; } public static void Main ( String [ ] args ) { String s = "100000101000" ; Console . WriteLine ( bcdToDecimal ( s ) ) ; } }

Index/key variables: i
Accumulator variables: check, i, mul, num, sum
Iterator variables: i
Class/struct names: GFG