dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; using System . Collections . Generic ; class Node { public int data ; public Node next , prev ; } class GFG { static int countTriplets ( Node head , int x ) { Node ptr , ptr1 , ptr2 ; int count = 0 ; Dictionary < int , Node > um = new Dictionary < int , Node > ( ) ; for ( ptr = head ; ptr != null ; ptr = ptr . next ) { um . Add ( ptr . data , ptr ) ; } for ( ptr1 = head ; ptr1 != null ; ptr1 = ptr1 . next ) { for ( ptr2 = ptr1 . next ; ptr2 != null ; ptr2 = ptr2 . next ) { int p_product = ( ptr1 . data * ptr2 . data ) ; if ( um . ContainsKey ( x / p_product ) && um [ x / p_product ] != ptr1 && um [ x / p_product ] != ptr2 ) { count ++ ; } } } return ( count / 3 ) ; } static Node insert ( Node head , int data ) { Node temp = new Node ( ) ; temp . data = data ; temp . next = temp . prev = null ; if ( head == null ) { head = temp ; } else { temp . next = head ; head . prev = temp ; head = temp ; } return head ; } static public void Main ( ) { Node head = null ; head = insert ( head , 9 ) ; head = insert ( head , 8 ) ; head = insert ( head , 6 ) ; head = insert ( head , 5 ) ; head = insert ( head , 4 ) ; head = insert ( head , 2 ) ; head = insert ( head , 1 ) ; int x = 8 ; Console . WriteLine ( " Count ▁ = ▁ " + countTriplets ( head , x ) ) ; } }

Accumulator variables: count
Iterator variables: ptr, ptr1, ptr2
Class/struct names: GFG, Node
C# program:
using System ; class GFG { static int solve ( int N , int M , int [ ] cp , int [ ] sp ) { int [ ] profit = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) profit [ i ] = sp [ i ] - cp [ i ] ; Array . Sort ( profit ) ; Array . Reverse ( profit ) ; int sum = 0 ; for ( int i = 0 ; i < M ; i ++ ) { if ( profit [ i ] > 0 ) sum += profit [ i ] ; else break ; } return sum ; } public static void Main ( ) { int N = 5 , M = 3 ; int [ ] CP = { 5 , 10 , 35 , 7 , 23 } ; int [ ] SP = { 11 , 10 , 0 , 9 , 19 } ; Console . Write ( solve ( N , M , CP , SP ) ) ; } }

Index/key variables: N, i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int findMaxNum ( int [ ] arr , int n ) { Array . Sort ( arr ) ; int num = arr [ 0 ] ; for ( int i = n - 1 ; i >= 0 ; i -- ) { num = num * 10 + arr [ i ] ; } return num ; } static public void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 , 0 } ; int n = arr . Length ; Console . WriteLine ( findMaxNum ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int minimumSets ( int [ ] arr , int n , int key ) { int i , j ; Array . Sort ( arr ) ; for ( i = 0 , j = n - 1 ; i <= j ; ++ i ) if ( arr [ i ] + arr [ j ] <= key ) j -- ; return i ; } public static void Main ( ) { int [ ] arr = { 3 , 5 , 3 , 4 } ; int n = arr . Length ; int key = 5 ; Console . WriteLine ( minimumSets ( arr , n , key ) ) ; } }

Index/key variables: i, j
Accumulator variables: j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public class Node { public int data ; public Node prev ; public Node next ; } ; static Node insertAtTheBegin ( Node start_ref , int data ) { Node ptr1 = new Node ( ) ; ptr1 . data = data ; ptr1 . next = start_ref ; if ( start_ref != null ) ( start_ref ) . prev = ptr1 ; start_ref = ptr1 ; return start_ref ; } static void printList ( Node start ) { Node temp = start ; Console . WriteLine ( ) ; while ( temp != null ) { Console . Write ( temp . data + " ▁ " ) ; temp = temp . next ; } } static Node bubbleSort ( Node start ) { int swapped ; Node ptr1 ; Node lptr = null ; if ( start == null ) return null ; do { swapped = 0 ; ptr1 = start ; while ( ptr1 . next != lptr ) { if ( ptr1 . data > ptr1 . next . data ) { int t = ptr1 . data ; ptr1 . data = ptr1 . next . data ; ptr1 . next . data = t ; swapped = 1 ; } ptr1 = ptr1 . next ; } lptr = ptr1 ; } while ( swapped != 0 ) ; return start ; } public static void Main ( String [ ] args ) { int [ ] arr = { 12 , 56 , 2 , 11 , 1 , 90 } ; int i ; Node start = null ; for ( i = 0 ; i < 6 ; i ++ ) start = insertAtTheBegin ( start , arr [ i ] ) ; Console . Write ( " STRNEWLINE ▁ Linked ▁ list ▁ before ▁ sorting ▁ " ) ; printList ( start ) ; start = bubbleSort ( start ) ; Console . Write ( " STRNEWLINE ▁ Linked ▁ list ▁ after ▁ sorting ▁ " ) ; printList ( start ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG, Node
C# program:
using System ; class GFG { public static void substringSort ( String [ ] arr , int n , int maxLen ) { int [ ] count = new int [ maxLen ] ; String [ ] sortedArr = new String [ maxLen ] ; for ( int i = 0 ; i < maxLen ; i ++ ) { count [ i ] = 0 ; sortedArr [ i ] = " " ; } for ( int i = 0 ; i < n ; i ++ ) { String s = arr [ i ] ; int len = s . Length ; if ( count [ len - 1 ] == 0 ) { sortedArr [ len - 1 ] = s ; count [ len - 1 ] = 1 ; } else if ( ReferenceEquals ( s , sortedArr [ len - 1 ] ) ) { count [ len - 1 ] ++ ; } else { Console . WriteLine ( " Cannot ▁ be ▁ sorted " ) ; return ; } } int index = 0 ; while ( count [ index ] == 0 ) index ++ ; int prev = index ; String prevString = sortedArr [ prev ] ; index ++ ; for ( ; index < maxLen ; index ++ ) { if ( count [ index ] != 0 ) { String current = sortedArr [ index ] ; if ( current . Contains ( prevString ) ) { prev = index ; prevString = current ; } else { Console . WriteLine ( " Cannot ▁ be ▁ sorted " ) ; return ; } } } for ( int i = 0 ; i < maxLen ; i ++ ) { String s = sortedArr [ i ] ; for ( int j = 0 ; j < count [ i ] ; j ++ ) { Console . WriteLine ( s ) ; } } } public static void Main ( String [ ] args ) { int maxLen = 100 ; String [ ] arr1 = { " d " , " zddsaaz " , " ds " , " ddsaa " , " dds " , " dds " } ; substringSort ( arr1 , arr1 . Length , maxLen ) ; String [ ] arr2 = { " for " , " rof " } ; substringSort ( arr2 , arr2 . Length , maxLen ) ; } }

Index/key variables: i, index, maxLen, prev
Accumulator variables: i, index, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static void printPairs ( int [ ] arr , int n ) { bool pair_exists = false ; Array . Sort ( arr ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] < 0 ) { if ( Array . BinarySearch ( arr , - arr [ i ] ) != - 1 ) { Console . WriteLine ( arr [ i ] + " , ▁ " + - arr [ i ] ) ; pair_exists = true ; } } else break ; } if ( pair_exists == false ) Console . WriteLine ( " No ▁ such ▁ pair ▁ exists " ) ; } public static void Main ( ) { int [ ] arr = { 4 , 8 , 9 , - 4 , 1 , - 1 , - 8 , - 9 } ; int n = arr . Length ; printPairs ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Boolean variables: pair_exists
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool areSame ( List < int > a , List < int > b ) { a . Sort ( ) ; b . Sort ( ) ; return ( a == b ) ; } public static void Main ( ) { List < int > a = new List < int > { 7 , 7 , 5 } ; List < int > b = new List < int > { 7 , 5 , 5 } ; if ( areSame ( a , b ) ) Console . WriteLine ( " Yes STRNEWLINE " ) ; else Console . WriteLine ( " No STRNEWLINE " ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { static int minEdgeBFS ( ArrayList [ ] edges , int u , int v , int n ) { ArrayList visited = new ArrayList ( ) ; for ( int i = 0 ; i < n ; i ++ ) { visited . Add ( false ) ; } ArrayList distance = new ArrayList ( ) ; for ( int i = 0 ; i < n ; i ++ ) { distance . Add ( 0 ) ; } Queue Q = new Queue ( ) ; distance [ u ] = 0 ; Q . Enqueue ( u ) ; visited [ u ] = true ; while ( Q . Count != 0 ) { int x = ( int ) Q . Dequeue ( ) ; for ( int i = 0 ; i < edges [ x ] . Count ; i ++ ) { if ( ( bool ) visited [ ( int ) edges [ x ] [ i ] ] ) continue ; distance [ ( int ) edges [ x ] [ i ] ] = ( int ) distance [ x ] + 1 ; Q . Enqueue ( ( int ) edges [ x ] [ i ] ) ; visited [ ( int ) edges [ x ] [ i ] ] = true ; } } return ( int ) distance [ v ] ; } static void addEdge ( ArrayList [ ] edges , int u , int v ) { edges [ u ] . Add ( v ) ; edges [ v ] . Add ( u ) ; } public static void Main ( string [ ] args ) { int n = 9 ; ArrayList [ ] edges = new ArrayList [ 9 ] ; for ( int i = 0 ; i < 9 ; i ++ ) { edges [ i ] = new ArrayList ( ) ; } addEdge ( edges , 0 , 1 ) ; addEdge ( edges , 0 , 7 ) ; addEdge ( edges , 1 , 7 ) ; addEdge ( edges , 1 , 2 ) ; addEdge ( edges , 2 , 3 ) ; addEdge ( edges , 2 , 5 ) ; addEdge ( edges , 2 , 8 ) ; addEdge ( edges , 3 , 4 ) ; addEdge ( edges , 3 , 5 ) ; addEdge ( edges , 4 , 5 ) ; addEdge ( edges , 5 , 6 ) ; addEdge ( edges , 6 , 7 ) ; addEdge ( edges , 7 , 8 ) ; int u = 0 ; int v = 5 ; Console . Write ( minEdgeBFS ( edges , u , v , n ) ) ; } }

Index/key variables: i, u, v, x
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int findMinimumSwaps ( int [ ] arr , int n , int k ) { int pos = 0 , num_min , num_max , need_minimum , need_maximum , swaps ; num_min = num_max = need_minimum = 0 ; need_maximum = swaps = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] < k ) { num_min ++ ; } else if ( arr [ i ] > k ) { num_max ++ ; } } for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == k ) { pos = i ; break ; } } int left , right , mid ; left = 0 ; right = n - 1 ; while ( left <= right ) { mid = ( left + right ) / 2 ; if ( arr [ mid ] == k ) { break ; } else if ( arr [ mid ] > k ) { if ( pos > mid ) { need_minimum ++ ; } else { num_min -- ; } left = mid + 1 ; } else { if ( pos < mid ) { need_maximum ++ ; } else { num_max -- ; } right = mid - 1 ; } } if ( need_minimum > need_maximum ) { swaps = swaps + need_maximum ; num_min = num_min - need_maximum ; need_minimum = need_minimum - need_maximum ; need_maximum = 0 ; } else { swaps = swaps + need_minimum ; num_max = num_max - need_minimum ; need_maximum = need_maximum - need_minimum ; need_minimum = 0 ; } if ( need_maximum > num_max need_minimum > num_min ) { return - 1 ; } else { return ( swaps + need_maximum + need_minimum ) ; } } public static void Main ( ) { int [ ] arr = { 3 , 10 , 6 , 7 , 2 , 5 , 4 } ; int k = 4 ; int n = arr . Length ; Console . WriteLine ( findMinimumSwaps ( arr , n , k ) ) ; } }

Index/key variables: i, mid
Accumulator variables: i, need_maximum, need_minimum, num_max, num_min
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void reverse ( int [ ] a ) { int i , k , n = a . Length ; int t ; for ( i = 0 ; i < n / 2 ; i ++ ) { t = a [ i ] ; a [ i ] = a [ n - i - 1 ] ; a [ n - i - 1 ] = t ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 5 , 8 , 9 , 6 , 7 , 3 , 4 , 2 , 0 } ; int n = arr . Length ; Array . Sort ( arr ) ; reverse ( arr ) ; Console . WriteLine ( " Array ▁ after ▁ sorting ▁ : ▁ STRNEWLINE " ) ; for ( int i = 0 ; i < n ; ++ i ) { Console . Write ( arr [ i ] + " ▁ " ) ; } } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static Boolean function ( char [ ] str ) { int l = str . Length ; Array . Sort ( str , 0 , ( l / 2 ) ) ; Array . Sort ( str , ( l / 2 ) , l - ( l / 2 ) ) ; for ( int i = 0 ; i < l / 2 ; i ++ ) if ( str [ i ] != str [ l / 2 + i ] ) return true ; return false ; } public static void Main ( String [ ] args ) { char [ ] str = ( " abcasdsabcae " ) . ToCharArray ( ) ; if ( function ( str ) ) Console . WriteLine ( " Yes , ▁ both ▁ halves ▁ differ " + " ▁ by ▁ at ▁ least ▁ one ▁ character " ) ; else Console . WriteLine ( " No , ▁ both ▁ halves ▁ do " + " ▁ not ▁ differ ▁ at ▁ all " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int [ ] inputArray = { 0 , 1 , 1 , 0 , 1 , 2 , 1 , 2 , 0 , 0 , 0 , 1 } ; static List < int > outputArray = new List < int > ( ) ; static int indexOfOne = 0 ; static void print ( ) { foreach ( int item in inputArray ) if ( item == 2 ) outputArray . Add ( item ) ; else if ( item == 1 ) { outputArray . Insert ( indexOfOne , item ) ; indexOfOne += 1 ; } else if ( item == 0 ) { outputArray . Insert ( 0 , item ) ; indexOfOne += 1 ; } else { Console . WriteLine ( " ▁ wrong ▁ value ▁ - ▁ Aborting ▁ " ) ; continue ; } } public static void Main ( String [ ] args ) { print ( ) ; foreach ( int item in outputArray ) Console . Write ( item + " , ▁ " ) ; } }

Accumulator variables: indexOfOne
Iterator variables: item
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int minimumBox ( int [ ] arr , int n ) { Queue < int > q = new Queue < int > ( ) ; Array . Sort ( arr ) ; q . Enqueue ( arr [ 0 ] ) ; for ( int i = 1 ; i < n ; i ++ ) { int now = q . Peek ( ) ; if ( arr [ i ] >= 2 * now ) q . Dequeue ( ) ; q . Enqueue ( arr [ i ] ) ; } return q . Count ; } public static void Main ( ) { int [ ] arr = { 4 , 1 , 2 , 8 } ; int n = arr . Length ; Console . WriteLine ( minimumBox ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void sortBinaryArray ( int [ ] a , int n ) { int j = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] < 1 ) { j ++ ; int temp = a [ j ] ; a [ j ] = a [ i ] ; a [ i ] = temp ; } } } public static void Main ( ) { int [ ] a = { 1 , 0 , 0 , 1 , 0 , 1 , 0 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 1 , 0 , 1 , 0 , 0 } ; int n = a . Length ; sortBinaryArray ( a , n ) ; for ( int i = 0 ; i < n ; i ++ ) Console . Write ( a [ i ] + " ▁ " ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int MAX = 1000 ; static int findDuplicate ( int [ ] arr , int n , int k ) { int res = MAX + 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] > 0 ) { int count = 1 ; for ( int j = i + 1 ; j < n ; j ++ ) if ( arr [ i ] == arr [ j ] ) count += 1 ; if ( count == k ) res = Math . Min ( res , arr [ i ] ) ; } } return res ; } public static void Main ( ) { int [ ] arr = { 2 , 2 , 1 , 3 , 1 } ; int k = 2 ; int n = arr . Length ; Console . WriteLine ( findDuplicate ( arr , n , k ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static int findDuplicate ( int [ ] arr , int n , int k ) { Array . Sort ( arr ) ; int i = 0 ; while ( i < n ) { int j , count = 1 ; for ( j = i + 1 ; j < n && arr [ j ] == arr [ i ] ; j ++ ) count ++ ; if ( count == k ) return arr [ i ] ; i = j ; } return - 1 ; } public static void Main ( ) { int [ ] arr = { 2 , 2 , 1 , 3 , 1 } ; int k = 2 ; int n = arr . Length ; Console . WriteLine ( findDuplicate ( arr , n , k ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, j
Iterator variables: j
Class/struct names: GFG
C# program:
using System ; public class GFG { static string longestCommonPrefix ( String [ ] a ) { int size = a . Length ; if ( size == 0 ) return " " ; if ( size == 1 ) return a [ 0 ] ; Array . Sort ( a ) ; int end = Math . Min ( a [ 0 ] . Length , a [ size - 1 ] . Length ) ; int i = 0 ; while ( i < end && a [ 0 ] [ i ] == a [ size - 1 ] [ i ] ) i ++ ; string pre = a [ 0 ] . Substring ( 0 , i ) ; return pre ; } public static void Main ( ) { string [ ] input = { " geeksforgeeks " , " geeks " , " geek " , " geezer " } ; Console . WriteLine ( " The ▁ longest ▁ Common " + " ▁ Prefix ▁ is ▁ : ▁ " + longestCommonPrefix ( input ) ) ; } }

Index/key variables: i
Accumulator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void find ( int [ ] arr , int n , int k ) { Array . Sort ( arr ) ; int b = ( int ) Math . Ceiling ( n / k * 1.0 ) ; int min_sum = 0 , max_sum = 0 ; for ( int i = 0 ; i < b ; i ++ ) min_sum += arr [ i ] ; for ( int i = 2 ; i < arr . Length ; i ++ ) max_sum += arr [ i ] ; Console . WriteLine ( " minimum ▁ " + min_sum ) ; Console . WriteLine ( " maximum ▁ " + max_sum ) ; } public static void Main ( ) { int [ ] arr = { 3 , 2 , 1 , 4 } ; int n = arr . Length ; int k = 2 ; find ( arr , n , k ) ; } }

Index/key variables: i
Accumulator variables: i, max_sum, min_sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool checkForSorting ( int [ ] arr , int n ) { for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( arr [ i ] > arr [ i + 1 ] ) { if ( arr [ i ] - arr [ i + 1 ] == 1 ) { else return false ; } } return true ; } public static void Main ( ) { int [ ] arr = { 1 , 0 , 3 , 2 } ; int n = arr . Length ; if ( checkForSorting ( arr , n ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class solution { static void sort ( String [ ] s , int n ) { for ( int i = 1 ; i < n ; i ++ ) { String temp = s [ i ] ; int j = i - 1 ; while ( j >= 0 && temp . Length < s [ j ] . Length ) { s [ j + 1 ] = s [ j ] ; j -- ; } s [ j + 1 ] = temp ; } } static void printArraystring ( String [ ] str , int n ) { for ( int i = 0 ; i < n ; i ++ ) Console . Write ( str [ i ] + " ▁ " ) ; } public static void Main ( ) { String [ ] arr = { " GeeksforGeeks " , " I " , " from " , " am " } ; int n = arr . Length ; sort ( arr , n ) ; printArraystring ( arr , n ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i
Class/struct names: solution
C# program:
using System ; class GFG { static int partition ( int [ ] arr , int low , int high ) { int pivot = arr [ low ] ; int i = low - 1 , j = high + 1 ; while ( true ) { do { i ++ ; } while ( arr [ i ] < pivot ) ; do { j -- ; } while ( arr [ j ] > pivot ) ; if ( i >= j ) return j ; int temp = arr [ i ] ; arr [ i ] = arr [ j ] ; arr [ j ] = temp ; } } static void quickSort ( int [ ] arr , int low , int high ) { if ( low < high ) { int pi = partition ( arr , low , high ) ; quickSort ( arr , low , pi ) ; quickSort ( arr , pi + 1 , high ) ; } } static void printArray ( int [ ] arr , int n ) { for ( int i = 0 ; i < n ; i ++ ) Console . Write ( " ▁ " + arr [ i ] ) ; Console . WriteLine ( ) ; } static public void Main ( ) { int [ ] arr = { 10 , 7 , 8 , 9 , 1 , 5 } ; int n = arr . Length ; quickSort ( arr , 0 , n - 1 ) ; Console . WriteLine ( " Sorted ▁ array : ▁ " ) ; printArray ( arr , n ) ; } }

Index/key variables: i, j, low
Accumulator variables: i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int ksmallest ( int [ ] arr , int n , int k ) { Array . Sort ( arr ) ; if ( k < arr [ 0 ] ) return k ; if ( k == arr [ 0 ] ) return arr [ 0 ] + 1 ; if ( k > arr [ n - 1 ] ) return k + n ; if ( arr [ 0 ] == 1 ) k -- ; else k -= ( arr [ 0 ] - 1 ) ; for ( int i = 1 ; i < n ; i ++ ) { int c = arr [ i ] - arr [ i - 1 ] - 1 ; if ( k <= c ) return arr [ i - 1 ] + k ; else k -= c ; } return arr [ n - 1 ] + k ; } static public void Main ( ) { int k = 1 ; int [ ] arr = { 1 } ; int n = arr . Length ; Console . WriteLine ( ksmallest ( arr , n , k ) ) ; } }

Index/key variables: i
Accumulator variables: i, k
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { public class Node { public int key ; public Node left , right ; public Node ( int item ) { key = item ; left = right = null ; } } Node root ; GFG ( ) { root = null ; } void insert ( int key ) { root = insertRec ( root , key ) ; } Node insertRec ( Node root , int key ) { if ( root == null ) { root = new Node ( key ) ; return root ; } if ( key < root . key ) root . left = insertRec ( root . left , key ) ; else if ( key > root . key ) root . right = insertRec ( root . right , key ) ; return root ; } void inorderRec ( Node root ) { if ( root != null ) { inorderRec ( root . left ) ; Console . Write ( root . key + " ▁ " ) ; inorderRec ( root . right ) ; } } void treeins ( int [ ] arr ) { for ( int i = 0 ; i < arr . Length ; i ++ ) { insert ( arr [ i ] ) ; } } public static void Main ( String [ ] args ) { GFG tree = new GFG ( ) ; int [ ] arr = { 5 , 4 , 7 , 2 , 11 } ; tree . treeins ( arr ) ; tree . inorderRec ( tree . root ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG, Node
C# program:
using System ; class GFG { public static bool isEven ( int n ) { if ( ( n & 1 ) == 0 ) return true ; else return false ; } public static void Main ( ) { int n = 101 ; if ( isEven ( n ) == true ) Console . WriteLine ( " Even " ) ; else Console . WriteLine ( " Odd " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int findSubsequenceCount ( string S , string T ) { int m = T . Length ; int n = S . Length ; if ( m > n ) return 0 ; int [ , ] mat = new int [ m + 1 , n + 1 ] ; for ( int i = 1 ; i <= m ; i ++ ) mat [ i , 0 ] = 0 ; for ( int j = 0 ; j <= n ; j ++ ) mat [ 0 , j ] = 1 ; for ( int i = 1 ; i <= m ; i ++ ) { for ( int j = 1 ; j <= n ; j ++ ) { if ( T [ i - 1 ] != S [ j - 1 ] ) mat [ i , j ] = mat [ i , j - 1 ] ; else mat [ i , j ] = mat [ i , j - 1 ] + mat [ i - 1 , j - 1 ] ; } } return mat [ m , n ] ; } public static void Main ( ) { string T = " ge " ; string S = " geeksforgeeks " ; Console . WriteLine ( findSubsequenceCount ( S , T ) ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { public static void partition ( int [ ] a , int l , int r , ref int i , ref int j ) { i = l - 1 ; j = r ; int p = l - 1 , q = r ; int v = a [ r ] ; while ( true ) { while ( a [ ++ i ] < v ) ; while ( v < a [ -- j ] ) if ( j == l ) break ; if ( i >= j ) break ; swap ( ref a [ i ] , ref a [ j ] ) ; if ( a [ i ] == v ) { p ++ ; swap ( ref a [ p ] , ref a [ i ] ) ; } if ( a [ j ] == v ) { q -- ; swap ( ref a [ j ] , ref a [ q ] ) ; } } swap ( ref a [ i ] , ref a [ r ] ) ; j = i - 1 ; for ( int k = l ; k < p ; k ++ , j -- ) swap ( ref a [ k ] , ref a [ j ] ) ; i = i + 1 ; for ( int k = r - 1 ; k > q ; k -- , i ++ ) swap ( ref a [ i ] , ref a [ k ] ) ; } public static void quicksort ( int [ ] a , int l , int r ) { if ( r <= l ) return ; int i = 0 , j = 0 ; partition ( a , l , r , ref i , ref j ) ; quicksort ( a , l , j ) ; quicksort ( a , i , r ) ; } public static void printarr ( int [ ] a , int n ) { for ( int i = 0 ; i < n ; ++ i ) Console . Write ( a [ i ] + " ▁ " ) ; Console . Write ( " STRNEWLINE " ) ; } static void Main ( ) { int [ ] a = { 4 , 9 , 4 , 4 , 1 , 9 , 4 , 4 , 9 , 4 , 4 , 1 , 4 } ; int size = a . Length ; static void swap < T > ( ref T lhs , ref T rhs ) { T temp ; temp = lhs ; lhs = rhs ; rhs = temp ; } printarr ( a , size ) ; quicksort ( a , 0 , size - 1 ) ; printarr ( a , size ) ; } }

Index/key variables: i, j, k, p, q, r
Accumulator variables: i, j, k, p, q
Iterator variables: i, k
Class/struct names: GFG
C# program:
using System ; class GFG { static void swap < T > ( ref T lhs , ref T rhs ) { T temp ; temp = lhs ; lhs = rhs ; rhs = temp ; } public static void printarr ( int [ ] a , int n ) { for ( int i = 0 ; i < n ; ++ i ) Console . Write ( a [ i ] + " ▁ " ) ; Console . Write ( " STRNEWLINE " ) ; } public static void partition ( int [ ] a , int low , int high , ref int i , ref int j ) { if ( high - low <= 1 ) { if ( a [ high ] < a [ low ] ) swap ( ref a [ high ] , ref a [ low ] ) ; i = low ; j = high ; return ; } int mid = low ; int pivot = a [ high ] ; while ( mid <= high ) { if ( a [ mid ] < pivot ) swap ( ref a [ low ++ ] , ref a [ mid ++ ] ) ; else if ( a [ mid ] == pivot ) mid ++ ; else if ( a [ mid ] > pivot ) swap ( ref a [ mid ] , ref a [ high -- ] ) ; } i = low - 1 ; } public static void quicksort ( int [ ] a , int low , int high ) { return ; int i = 0 , j = 0 ; partition ( a , low , high , ref i , ref j ) ; quicksort ( a , low , i ) ; quicksort ( a , j , high ) ; } static void Main ( ) { int [ ] a = { 4 , 9 , 4 , 4 , 1 , 9 , 4 , 4 , 9 , 4 , 4 , 1 , 4 } ; int size = a . Length ; printarr ( a , size ) ; quicksort ( a , 0 , size - 1 ) ; printarr ( a , size ) ; } }

Index/key variables: high, i, low, mid
Accumulator variables: high, low, mid
Iterator variables: i
Class/struct names: GFG