dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; public class Node { public int key ; public Node left , right ; public Node ( int key ) { this . key = key ; left = right = null ; } } class GFG { public Node root ; public virtual int sum ( Node t ) { if ( t == null ) { return 0 ; } return t . key + sum ( t . left ) + sum ( t . right ) ; } public virtual int uncoveredSumLeft ( Node t ) { if ( t . left == null && t . right == null ) { return t . key ; } if ( t . left != null ) { return t . key + uncoveredSumLeft ( t . left ) ; } else { return t . key + uncoveredSumLeft ( t . right ) ; } } public virtual int uncoveredSumRight ( Node t ) { if ( t . left == null && t . right == null ) { return t . key ; } if ( t . right != null ) { return t . key + uncoveredSumRight ( t . right ) ; } else { return t . key + uncoveredSumRight ( t . left ) ; } } public virtual int uncoverSum ( Node t ) { int lb = 0 , rb = 0 ; if ( t . left != null ) { lb = uncoveredSumLeft ( t . left ) ; } if ( t . right != null ) { rb = uncoveredSumRight ( t . right ) ; } return t . key + lb + rb ; } public virtual bool isSumSame ( Node root ) { int sumUC = uncoverSum ( root ) ; int sumT = sum ( root ) ; return ( sumUC == ( sumT - sumUC ) ) ; } 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 ) { GFG tree = new GFG ( ) ; 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 ) ; if ( tree . isSumSame ( tree . root ) ) { Console . WriteLine ( " Sum ▁ of ▁ covered ▁ and ▁ " + " uncovered ▁ is ▁ same " ) ; } else { Console . WriteLine ( " Sum ▁ of ▁ covered ▁ and ▁ " + " uncovered ▁ is ▁ not ▁ same " ) ; } } }

Class/struct names: GFG, Node
C# program:
using System ; class GFG { static int countSetBits ( int x ) { int count = 0 ; while ( x != 0 ) { x &= ( x - 1 ) ; count ++ ; } return count ; } static int ceilLog2 ( int x ) { int count = 0 ; x -- ; while ( x > 0 ) { x = x >> 1 ; count ++ ; } return count ; } static bool isBleak ( int n ) { for ( int x = n - ceilLog2 ( n ) ; x < n ; x ++ ) if ( x + countSetBits ( x ) == n ) return false ; return true ; } public static void Main ( ) { if ( isBleak ( 3 ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; if ( isBleak ( 4 ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Accumulator variables: count, x
Iterator variables: x
Class/struct names: GFG
C# program:
using System ; class GFG { static int countStrings ( int n ) { int [ ] a = new int [ n ] ; int [ ] b = new int [ n ] ; a [ 0 ] = b [ 0 ] = 1 ; for ( int i = 1 ; i < n ; i ++ ) { a [ i ] = a [ i - 1 ] + b [ i - 1 ] ; b [ i ] = a [ i - 1 ] ; } return ( 1 << n ) - a [ n - 1 ] - b [ n - 1 ] ; } public static void Main ( ) { Console . WriteLine ( countStrings ( 5 ) ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int swapBits ( int n , int p1 , int p2 ) { n ^= 1 << p1 ; n ^= 1 << p2 ; return n ; } static void Main ( ) { Console . WriteLine ( " Result ▁ = ▁ " + swapBits ( 28 , 0 , 3 ) ) ; } }

Accumulator variables: n
Class/struct names: GFG
C# program:
using System ; public class Node { public int data ; public Node left , right ; public Node ( int item ) { data = item ; left = right = null ; } } class GFG { public Node root ; public virtual bool isSibling ( Node node , Node a , Node b ) { if ( node == null ) { return false ; } return ( ( node . left == a && node . right == b ) || ( node . left == b && node . right == a ) || isSibling ( node . left , a , b ) || isSibling ( node . right , a , b ) ) ; } public virtual int level ( Node node , Node ptr , int lev ) { if ( node == null ) { return 0 ; } if ( node == ptr ) { return lev ; } int l = level ( node . left , ptr , lev + 1 ) ; if ( l != 0 ) { return l ; } return level ( node . right , ptr , lev + 1 ) ; } public virtual bool isCousin ( Node node , Node a , Node b ) { return ( ( level ( node , a , 1 ) == level ( node , b , 1 ) ) && ( ! isSibling ( node , a , b ) ) ) ; } public static void Main ( string [ ] args ) { GFG tree = new GFG ( ) ; 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 . right . right = new Node ( 15 ) ; tree . root . right . left = new Node ( 6 ) ; tree . root . right . right = new Node ( 7 ) ; tree . root . right . left . right = new Node ( 8 ) ; Node Node1 , Node2 ; Node1 = tree . root . left . left ; Node2 = tree . root . right . right ; if ( tree . isCousin ( tree . root , Node1 , Node2 ) ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }

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 Leaf { public int leaflevel = 0 ; } class GFG { public Node root ; public Leaf mylevel = new Leaf ( ) ; public virtual bool checkUtil ( Node node , int level , Leaf leafLevel ) { if ( node == null ) { return true ; } if ( node . left == null && node . right == null ) { if ( leafLevel . leaflevel == 0 ) { leafLevel . leaflevel = level ; return true ; } return ( level == leafLevel . leaflevel ) ; } return checkUtil ( node . left , level + 1 , leafLevel ) && checkUtil ( node . right , level + 1 , leafLevel ) ; } public virtual bool check ( Node node ) { int level = 0 ; return checkUtil ( node , level , mylevel ) ; } public static void Main ( string [ ] args ) { GFG tree = new GFG ( ) ; tree . root = new Node ( 12 ) ; tree . root . left = new Node ( 5 ) ; tree . root . left . left = new Node ( 3 ) ; tree . root . left . right = new Node ( 9 ) ; tree . root . left . left . left = new Node ( 1 ) ; tree . root . left . right . left = new Node ( 1 ) ; if ( tree . check ( tree . root ) ) { Console . WriteLine ( " Leaves ▁ are ▁ at ▁ same ▁ level " ) ; } else { Console . WriteLine ( " Leaves ▁ are ▁ not ▁ at ▁ same ▁ level " ) ; } } }

Class/struct names: GFG, Leaf, Node
C# program:
using System ; using System . Collections . Generic ; class GFG { public class Node { public int key ; public List < Node > child ; public Node ( int data ) { key = data ; child = new List < Node > ( ) ; } } ; static int numberOfSiblings ( Node root , int x ) { if ( root == null ) return 0 ; Queue < Node > q = new Queue < Node > ( ) ; q . Enqueue ( root ) ; while ( q . Count > 0 ) { Node p = q . Peek ( ) ; q . Dequeue ( ) ; for ( int i = 0 ; i < p . child . Count ; i ++ ) { if ( p . child [ i ] . key == x ) return p . child . Count - 1 ; q . Enqueue ( p . child [ i ] ) ; } } return - 1 ; } public static void Main ( String [ ] args ) { Node root = new Node ( 50 ) ; ( root . child ) . Add ( new Node ( 2 ) ) ; ( root . child ) . Add ( new Node ( 30 ) ) ; ( root . child ) . Add ( new Node ( 14 ) ) ; ( root . child ) . Add ( new Node ( 60 ) ) ; ( root . child [ 0 ] . child ) . Add ( new Node ( 15 ) ) ; ( root . child [ 0 ] . child ) . Add ( new Node ( 25 ) ) ; ( root . child [ 0 ] . child [ 1 ] . child ) . Add ( new Node ( 70 ) ) ; ( root . child [ 0 ] . child [ 1 ] . child ) . Add ( new Node ( 100 ) ) ; ( root . child [ 1 ] . child ) . Add ( new Node ( 6 ) ) ; ( root . child [ 1 ] . child ) . Add ( new Node ( 1 ) ) ; ( root . child [ 2 ] . child ) . Add ( new Node ( 7 ) ) ; ( root . child [ 2 ] . child [ 0 ] . child ) . Add ( new Node ( 17 ) ) ; ( root . child [ 2 ] . child [ 0 ] . child ) . Add ( new Node ( 99 ) ) ; ( root . child [ 2 ] . child [ 0 ] . child ) . Add ( new Node ( 27 ) ) ; ( root . child [ 3 ] . child ) . Add ( new Node ( 16 ) ) ; int x = 100 ; Console . WriteLine ( numberOfSiblings ( root , x ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG, Node
C# program:
using System ; using System . Collections . Generic ; public class Node { public int data ; public Node left , right ; public Node ( int key ) { int data = key ; left = right = null ; } } public class GFG { static bool checkLevelLeafNode ( Node root ) { if ( root == null ) return true ; Queue < Node > q = new Queue < Node > ( ) ; q . Enqueue ( root ) ; int result = int . MaxValue ; int level = 0 ; while ( q . Count != 0 ) { int size = q . Count ; level ++ ; while ( size > 0 ) { Node temp = q . Dequeue ( ) ; if ( temp . left != null ) { q . Enqueue ( temp . left ) ; if ( temp . left . left != null && temp . left . right != null ) { if ( result == int . MaxValue ) result = level ; else if ( result != level ) return false ; } } if ( temp . right != null ) { q . Enqueue ( temp . right ) ; if ( temp . right . left != null && temp . right . right != null ) { if ( result == int . MaxValue ) result = level ; else if ( result != level ) return false ; } } size -- ; } } return true ; } public static void Main ( String [ ] args ) { Node root = new Node ( 1 ) ; root . left = new Node ( 2 ) ; root . right = new Node ( 3 ) ; root . left . right = new Node ( 4 ) ; root . right . left = new Node ( 5 ) ; root . right . right = new Node ( 6 ) ; bool result = checkLevelLeafNode ( root ) ; if ( result == true ) Console . WriteLine ( " All ▁ leaf ▁ nodes ▁ are ▁ at ▁ same ▁ level " ) ; else Console . WriteLine ( " Leaf ▁ nodes ▁ not ▁ at ▁ same ▁ level " ) ; } }

Accumulator variables: level, size
Class/struct names: GFG, Node
C# program:
using System ; using System . Collections . Generic ; public class QueueExample { public static void Main ( String [ ] args ) { Queue < int > q = new Queue < int > ( ) ; for ( int i = 0 ; i < 5 ; i ++ ) q . Enqueue ( i ) ; Console . Write ( " Elements ▁ of ▁ queue - " ) ; foreach ( int s in q ) Console . Write ( s + " ▁ " ) ; int removedele = q . Dequeue ( ) ; Console . Write ( " STRNEWLINE removed ▁ element - " + removedele + " STRNEWLINE " ) ; foreach ( int s in q ) Console . Write ( s + " ▁ " ) ; int head = q . Peek ( ) ; Console . Write ( " STRNEWLINE head ▁ of ▁ queue - " + head ) ; int size = q . Count ; Console . WriteLine ( " STRNEWLINE Size ▁ of ▁ queue - " + size ) ; } }

Accumulator variables: i
Iterator variables: i, s
Class/struct names: QueueExample
C# program:
using System ; using System . Collections . Generic ; class GFG { static void stack_push ( Stack < int > stack ) { for ( int i = 0 ; i < 5 ; i ++ ) { stack . Push ( i ) ; } } static void stack_pop ( Stack < int > stack ) { Console . WriteLine ( " Pop ▁ : " ) ; for ( int i = 0 ; i < 5 ; i ++ ) { int y = ( int ) stack . Pop ( ) ; Console . WriteLine ( y ) ; } } static void stack_peek ( Stack < int > stack ) { int element = ( int ) stack . Peek ( ) ; Console . WriteLine ( " Element ▁ on ▁ stack ▁ top ▁ : ▁ " + element ) ; } static void stack_search ( Stack < int > stack , int element ) { bool pos = stack . Contains ( element ) ; if ( pos == false ) Console . WriteLine ( " Element ▁ not ▁ found " ) ; else Console . WriteLine ( " Element ▁ is ▁ found ▁ at ▁ position ▁ " + pos ) ; } public static void Main ( String [ ] args ) { Stack < int > stack = new Stack < int > ( ) ; stack_push ( stack ) ; stack_pop ( stack ) ; stack_push ( stack ) ; stack_peek ( stack ) ; stack_search ( stack , 2 ) ; stack_search ( stack , 6 ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void printQueue ( Queue < long > queue ) { while ( queue . Count != 0 ) { Console . Write ( queue . Peek ( ) + " ▁ " ) ; queue . Dequeue ( ) ; } } static void reverseQueue ( ref Queue < long > q ) { if ( q . Count == 0 ) return ; long data = q . Peek ( ) ; q . Dequeue ( ) ; reverseQueue ( ref q ) ; q . Enqueue ( data ) ; } static void Main ( ) { Queue < long > queue = new Queue < long > ( ) ; queue . Enqueue ( 56 ) ; queue . Enqueue ( 27 ) ; queue . Enqueue ( 30 ) ; queue . Enqueue ( 45 ) ; queue . Enqueue ( 85 ) ; queue . Enqueue ( 92 ) ; queue . Enqueue ( 58 ) ; queue . Enqueue ( 80 ) ; queue . Enqueue ( 90 ) ; queue . Enqueue ( 100 ) ; reverseQueue ( ref queue ) ; printQueue ( queue ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int minIndex ( ref Queue < int > q , int sortedIndex ) { int min_index = - 1 ; int min_val = int . MaxValue ; int n = q . Count ; for ( int i = 0 ; i < n ; i ++ ) { int curr = q . Peek ( ) ; q . Dequeue ( ) ; if ( curr <= min_val && i <= sortedIndex ) { min_index = i ; min_val = curr ; } q . Enqueue ( curr ) ; } return min_index ; } static void insertMinToRear ( ref Queue < int > q , int min_index ) { int min_val = 0 ; int n = q . Count ; for ( int i = 0 ; i < n ; i ++ ) { int curr = q . Peek ( ) ; q . Dequeue ( ) ; if ( i != min_index ) q . Enqueue ( curr ) ; else min_val = curr ; } q . Enqueue ( min_val ) ; } static void sortQueue ( ref Queue < int > q ) { for ( int i = 1 ; i <= q . Count ; i ++ ) { int min_index = minIndex ( ref q , q . Count - i ) ; insertMinToRear ( ref q , min_index ) ; } } static void Main ( ) { Queue < int > q = new Queue < int > ( ) ; q . Enqueue ( 30 ) ; q . Enqueue ( 11 ) ; q . Enqueue ( 15 ) ; q . Enqueue ( 4 ) ; sortQueue ( ref q ) ; while ( q . Count != 0 ) { Console . Write ( q . Peek ( ) + " ▁ " ) ; q . Dequeue ( ) ; } Console . WriteLine ( ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class Node { public int key ; public Node left , right ; public Node ( int key ) { this . key = key ; left = right = null ; } } class GFG { public Node root ; public virtual int count ( Node node ) { if ( node == null ) { return 0 ; } return count ( node . left ) + count ( node . right ) + 1 ; } public virtual bool checkRec ( Node node , int n ) { if ( node == null ) { return false ; } if ( count ( node ) == n - count ( node ) ) { return true ; } return checkRec ( node . left , n ) || checkRec ( node . right , n ) ; } public virtual bool check ( Node node ) { int n = count ( node ) ; return checkRec ( node , n ) ; } public static void Main ( string [ ] args ) { GFG tree = new GFG ( ) ; tree . root = new Node ( 5 ) ; tree . root . left = new Node ( 1 ) ; tree . root . right = new Node ( 6 ) ; tree . root . left . left = new Node ( 3 ) ; tree . root . right . left = new Node ( 7 ) ; tree . root . right . right = new Node ( 4 ) ; if ( tree . check ( tree . root ) == true ) { Console . WriteLine ( " YES " ) ; } else { Console . WriteLine ( " NO " ) ; } } }

Class/struct names: GFG, Node
C# program:
using System ; using System . Collections . Generic ; public class SlidingWindow { static void printMax ( int [ ] arr , int n , int k ) { List < int > Qi = new List < int > ( ) ; int i ; for ( i = 0 ; i < k ; ++ i ) { while ( Qi . Count != 0 && arr [ i ] >= arr [ Qi [ Qi . Count - 1 ] ] ) Qi . RemoveAt ( Qi . Count - 1 ) ; Qi . Insert ( Qi . Count , i ) ; } for ( ; i < n ; ++ i ) { Console . Write ( arr [ Qi [ 0 ] ] + " ▁ " ) ; while ( ( Qi . Count != 0 ) && Qi [ 0 ] <= i - k ) Qi . RemoveAt ( 0 ) ; while ( ( Qi . Count != 0 ) && arr [ i ] >= arr [ Qi [ Qi . Count - 1 ] ] ) Qi . RemoveAt ( Qi . Count - 1 ) ; Qi . Insert ( Qi . Count , i ) ; } Console . Write ( arr [ Qi [ 0 ] ] ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 12 , 1 , 78 , 90 , 57 , 89 , 56 } ; int k = 3 ; printMax ( arr , arr . Length , k ) ; } }

Index/key variables: i
Iterator variables: i
Class/struct names: SlidingWindow
C# program:
using System ; using System . Collections . Generic ; class Geeks { public static int SumOfKsubArray ( int [ ] arr , int k ) { int sum = 0 ; List < int > S = new List < int > ( ) ; List < int > G = new List < int > ( ) ; int i = 0 ; for ( i = 0 ; i < k ; i ++ ) { while ( S . Count != 0 && arr [ S [ S . Count - 1 ] ] >= arr [ i ] ) S . RemoveAt ( S . Count - 1 ) ; while ( G . Count != 0 && arr [ G [ G . Count - 1 ] ] <= arr [ i ] ) G . RemoveAt ( G . Count - 1 ) ; G . Add ( i ) ; S . Add ( i ) ; } for ( ; i < arr . Length ; i ++ ) { sum += arr [ S [ 0 ] ] + arr [ G [ 0 ] ] ; while ( S . Count != 0 && S [ 0 ] <= i - k ) S . RemoveAt ( 0 ) ; while ( G . Count != 0 && G [ 0 ] <= i - k ) G . RemoveAt ( 0 ) ; while ( S . Count != 0 && arr [ S [ S . Count - 1 ] ] >= arr [ i ] ) S . RemoveAt ( S . Count - 1 ) ; while ( G . Count != 0 && arr [ G [ G . Count - 1 ] ] <= arr [ i ] ) G . RemoveAt ( G . Count - 1 ) ; G . Add ( i ) ; S . Add ( i ) ; } sum += arr [ S [ 0 ] ] + arr [ G [ 0 ] ] ; return sum ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 5 , - 1 , 7 , - 3 , - 1 , - 2 } ; int k = 3 ; Console . WriteLine ( SumOfKsubArray ( arr , k ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: Geeks
C# program:
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 bool res = false ; } public class BinaryTree { public Node root ; public virtual int count ( Node node ) { if ( node == null ) { return 0 ; } return count ( node . left ) + count ( node . right ) + 1 ; } public virtual int checkRec ( Node root , int n , Res res ) { if ( root == null ) { return 0 ; } int c = checkRec ( root . left , n , res ) + 1 + checkRec ( root . right , n , res ) ; if ( c == n - c ) { res . res = true ; } return c ; } public virtual bool check ( Node root ) { int n = count ( root ) ; Res res = new Res ( ) ; checkRec ( root , n , res ) ; return res . res ; } public static void Main ( string [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 5 ) ; tree . root . left = new Node ( 1 ) ; tree . root . right = new Node ( 6 ) ; tree . root . left . left = new Node ( 3 ) ; tree . root . right . left = new Node ( 7 ) ; tree . root . right . right = new Node ( 4 ) ; if ( tree . check ( tree . root ) == true ) { Console . WriteLine ( " YES " ) ; } else { Console . WriteLine ( " NO " ) ; } } }

Boolean variables: res
Class/struct names: BinaryTree, Node, Res
C# program:
using System ; class GFG { static int N = 3 ; static int M = 4 ; static void printDistance ( int [ , ] mat ) { int [ , ] ans = new int [ N , M ] ; for ( int i = 0 ; i < N ; i ++ ) for ( int j = 0 ; j < M ; j ++ ) ans [ i , j ] = int . MaxValue ; for ( int i = 0 ; i < N ; i ++ ) for ( int j = 0 ; j < M ; j ++ ) { for ( int k = 0 ; k < N ; k ++ ) for ( int l = 0 ; l < M ; l ++ ) { if ( mat [ k , l ] == 1 ) ans [ i , j ] = Math . Min ( ans [ i , j ] , Math . Abs ( i - k ) + Math . Abs ( j - l ) ) ; } } for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) Console . Write ( ans [ i , j ] + " ▁ " ) ; Console . WriteLine ( ) ; } } public static void Main ( ) { int [ , ] mat = { { 0 , 0 , 0 , 1 } , { 0 , 0 , 1 , 1 } , { 0 , 1 , 1 , 0 } } ; printDistance ( mat ) ; } }

Accumulator variables: i, j, k, l
Iterator variables: i, j, k, l
Class/struct names: GFG
C# program:
using System ; class GFG { static void printFirstNegativeInteger ( int [ ] arr , int n , int k ) { bool flag ; for ( int i = 0 ; i < ( n - k + 1 ) ; i ++ ) { flag = false ; for ( int j = 0 ; j < k ; j ++ ) { if ( arr [ i + j ] < 0 ) { Console . Write ( ( arr [ i + j ] ) + " ▁ " ) ; flag = true ; break ; } } if ( ! flag ) Console . Write ( "0" + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 12 , - 1 , - 7 , 8 , - 15 , 30 , 16 , 28 } ; int n = arr . Length ; int k = 3 ; printFirstNegativeInteger ( arr , n , k ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void printFirstNegativeint ( int [ ] arr , int n , int k ) { List < int > Di = new List < int > ( ) ; int i ; for ( i = 0 ; i < k ; i ++ ) if ( arr [ i ] < 0 ) Di . Add ( i ) ; for ( ; i < n ; i ++ ) { if ( Di . Count != 0 ) Console . Write ( arr [ Di [ 0 ] ] + " ▁ " ) ; else Console . Write ( "0" + " ▁ " ) ; while ( ( Di . Count != 0 ) && Di [ 0 ] < ( i - k + 1 ) ) Di . RemoveAt ( 0 ) ; if ( arr [ i ] < 0 ) Di . Add ( i ) ; } if ( Di . Count != 0 ) Console . Write ( arr [ Di [ 0 ] ] + " ▁ " ) ; else Console . Write ( "0" + " ▁ " ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 12 , - 1 , - 7 , 8 , - 15 , 30 , 16 , 28 } ; int n = arr . Length ; int k = 3 ; printFirstNegativeint ( arr , n , k ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void printFirstNegativeInteger ( int [ ] arr , int k , int n ) { int firstNegativeIndex = 0 ; int firstNegativeElement ; for ( int i = k - 1 ; i < n ; i ++ ) { while ( ( firstNegativeIndex < i ) && ( firstNegativeIndex <= i - k arr [ firstNegativeIndex ] > 0 ) ) { firstNegativeIndex ++ ; } if ( arr [ firstNegativeIndex ] < 0 ) { firstNegativeElement = arr [ firstNegativeIndex ] ; } else { firstNegativeElement = 0 ; } Console . Write ( firstNegativeElement + " ▁ " ) ; } } static public void Main ( ) { int [ ] arr = { 12 , - 1 , - 7 , 8 , - 15 , 30 , 16 , 28 } ; int n = arr . Length ; int k = 3 ; printFirstNegativeInteger ( arr , k , n ) ; } }

Index/key variables: firstNegativeIndex
Accumulator variables: firstNegativeIndex, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public class Node { public Node left , right ; public int data ; public Node ( int data ) { this . data = data ; left = null ; right = null ; } } static Boolean areAnagrams ( Node root1 , Node root2 ) { if ( root1 == null && root2 == null ) return true ; if ( root1 == null root2 == null ) return false ; Queue < Node > q1 = new Queue < Node > ( ) ; Queue < Node > q2 = new Queue < Node > ( ) ; q1 . Enqueue ( root1 ) ; q2 . Enqueue ( root2 ) ; while ( true ) { int n1 = q1 . Count , n2 = q2 . Count ; if ( n1 != n2 ) return false ; if ( n1 == 0 ) break ; List < int > curr_level1 = new List < int > ( ) ; List < int > curr_level2 = new List < int > ( ) ; while ( n1 > 0 ) { Node node1 = q1 . Peek ( ) ; q1 . Dequeue ( ) ; if ( node1 . left != null ) q1 . Enqueue ( node1 . left ) ; if ( node1 . right != null ) q1 . Enqueue ( node1 . right ) ; n1 -- ; Node node2 = q2 . Peek ( ) ; q2 . Dequeue ( ) ; if ( node2 . left != null ) q2 . Enqueue ( node2 . left ) ; if ( node2 . right != null ) q2 . Enqueue ( node2 . right ) ; curr_level1 . Add ( node1 . data ) ; curr_level2 . Add ( node2 . data ) ; } curr_level1 . Sort ( ) ; curr_level2 . Sort ( ) ; for ( int i = 0 ; i < curr_level1 . Count ; i ++ ) if ( curr_level1 [ i ] != curr_level2 [ i ] ) return false ; } return true ; } public static void Main ( String [ ] args ) { Node root1 = new Node ( 1 ) ; root1 . left = new Node ( 3 ) ; root1 . right = new Node ( 2 ) ; root1 . right . left = new Node ( 5 ) ; root1 . right . right = new Node ( 4 ) ; Node root2 = new Node ( 1 ) ; root2 . left = new Node ( 2 ) ; root2 . right = new Node ( 3 ) ; root2 . left . left = new Node ( 4 ) ; root2 . left . right = new Node ( 5 ) ; Console . WriteLine ( areAnagrams ( root1 , root2 ) ? " Yes " : " No " ) ; } }

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