dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . util . * ; class GFG { static class Node { int data ; Node next ; } static boolean isCircular ( Node head ) { if ( head == null ) return true ; Node node = head . next ; while ( node != null && node != head ) node = node . next ; return ( node == head ) ; } static Node newNode ( int data ) { Node temp = new Node ( ) ; temp . data = data ; temp . next = null ; return temp ; } public static void main ( String args [ ] ) { Node head = newNode ( 1 ) ; head . next = newNode ( 2 ) ; head . next . next = newNode ( 3 ) ; head . next . next . next = newNode ( 4 ) ; System . out . print ( isCircular ( head ) ? "Yes " ▁ : ▁ " No " ); head . next . next . next . next = head ; System . out . print ( isCircular ( head ) ? "Yes " ▁ : ▁ " No " ); } }

Class/struct names: GFG, Node
Java program:
public class GFG { static class Node { public int data ; public Node next ; public Node ( int data ) { this . data = data ; } } static void getJosephusPosition ( int m , int n ) { Node head = new Node ( 1 ) ; Node prev = head ; for ( int i = 2 ; i <= n ; i ++ ) { prev . next = new Node ( i ) ; prev = prev . next ; } prev . next = head ; Node ptr1 = head , ptr2 = head ; while ( ptr1 . next != ptr1 ) { int count = 1 ; while ( count != m ) { ptr2 = ptr1 ; ptr1 = ptr1 . next ; count ++ ; } ptr2 . next = ptr1 . next ; ptr1 = ptr2 . next ; } System . out . println ( " Last ▁ person ▁ left ▁ standing ▁ " + " ( Josephus ▁ Position ) ▁ is ▁ " + ptr1 . data ) ; } public static void main ( String args [ ] ) { int n = 14 , m = 2 ; getJosephusPosition ( m , n ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG, Node
Java program:
import java . util . HashMap ; import java . util . Map . Entry ; import java . util . Vector ; public class DiagonalTraversalBTree { static class Node { int data ; Node left ; Node right ; Node ( int data ) { this . data = data ; left = null ; right = null ; } } static void diagonalPrintUtil ( Node root , int d , HashMap < Integer , Vector < Integer > > diagonalPrint ) { if ( root == null ) return ; Vector < Integer > k = diagonalPrint . get ( d ) ; if ( k == null ) { k = new Vector < > ( ) ; k . add ( root . data ) ; } else { k . add ( root . data ) ; } diagonalPrint . put ( d , k ) ; diagonalPrintUtil ( root . left , d + 1 , diagonalPrint ) ; diagonalPrintUtil ( root . right , d , diagonalPrint ) ; } static void diagonalPrint ( Node root ) { HashMap < Integer , Vector < Integer > > diagonalPrint = new HashMap < > ( ) ; diagonalPrintUtil ( root , 0 , diagonalPrint ) ; System . out . println ( " Diagonal ▁ Traversal ▁ of ▁ Binnary ▁ Tree " ) ; for ( Entry < Integer , Vector < Integer > > entry : diagonalPrint . entrySet ( ) ) { System . out . println ( entry . getValue ( ) ) ; } } public static void main ( String [ ] args ) { Node root = new Node ( 8 ) ; root . left = new Node ( 3 ) ; root . right = new Node ( 10 ) ; root . left . left = new Node ( 1 ) ; root . left . right = new Node ( 6 ) ; root . right . right = new Node ( 14 ) ; root . right . right . left = new Node ( 13 ) ; root . left . right . left = new Node ( 4 ) ; root . left . right . right = new Node ( 7 ) ; diagonalPrint ( root ) ; } }

Iterator variables: entry
Class/struct names: DiagonalTraversalBTree, Node
Java program:
import java . util . * ; import java . lang . * ; import java . io . * ; class Array_imp { static int root = 0 ; static String [ ] str = new String [ 10 ] ; public void Root ( String key ) { str [ 0 ] = key ; } public void set_Left ( String key , int root ) { int t = ( root * 2 ) + 1 ; if ( str [ root ] == null ) { System . out . printf ( "Can't set child at %d, no parent foundNEW_LINE", t); } else { str [ t ] = key ; } } public void set_Right ( String key , int root ) { int t = ( root * 2 ) + 2 ; if ( str [ root ] == null ) { System . out . printf ( "Can't set child at %d, no parent foundNEW_LINE", t); } else { str [ t ] = key ; } } public void print_Tree ( ) { for ( int i = 0 ; i < 10 ; i ++ ) { if ( str [ i ] != null ) System . out . print ( str [ i ] ) ; else System . out . print ( " - " ) ; } } } class Tree { public static void main ( String [ ] args ) { Array_imp obj = new Array_imp ( ) ; obj . Root ( " A " ) ; obj . set_Right ( " C " , 0 ) ; obj . set_Left ( " D " , 1 ) ; obj . set_Right ( " E " , 1 ) ; obj . set_Left ( " F " , 2 ) ; obj . print_Tree ( ) ; } }

Index/key variables: i, root, t
Accumulator variables: i
Iterator variables: i
Class/struct names: Array_imp, Tree
Java program:
class Node { int data ; Node next ; Node ( int d ) { data = d ; next = null ; } } class LinkedList { Node head ; void push ( int new_data ) { Node new_node = new Node ( new_data ) ; new_node . next = head ; head = new_node ; } void printList ( ) { Node node = head ; while ( node != null ) { System . out . print ( node . data + " ▁ " ) ; node = node . next ; } System . out . println ( " " ) ; } int countNodes ( ) { int count = 0 ; Node s = head ; while ( s != null ) { count ++ ; s = s . next ; } return count ; } void swapKth ( int k ) { int n = countNodes ( ) ; if ( n < k ) return ; if ( 2 * k - 1 == n ) return ; Node x = head ; Node x_prev = null ; for ( int i = 1 ; i < k ; i ++ ) { x_prev = x ; x = x . next ; } Node y = head ; Node y_prev = null ; for ( int i = 1 ; i < n - k + 1 ; i ++ ) { y_prev = y ; y = y . next ; } if ( x_prev != null ) x_prev . next = y ; if ( y_prev != null ) y_prev . next = x ; Node temp = x . next ; x . next = y . next ; y . next = temp ; if ( k == 1 ) head = y ; if ( k == n ) head = x ; } public static void main ( String [ ] args ) { LinkedList llist = new LinkedList ( ) ; for ( int i = 8 ; i >= 1 ; i -- ) llist . push ( i ) ; System . out . print ( " Original ▁ linked ▁ list : ▁ " ) ; llist . printList ( ) ; System . out . println ( " " ) ; for ( int i = 1 ; i < 9 ; i ++ ) { llist . swapKth ( i ) ; System . out . println ( " Modified ▁ List ▁ for ▁ k ▁ = ▁ " + i ) ; llist . printList ( ) ; System . out . println ( " " ) ; } } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: LinkedList, Node
Java program:
class GFG { static class Node { int data ; Node next , prev ; } ; static void pairSum ( Node head , int x ) { Node first = head ; Node second = head ; while ( second . next != null ) second = second . next ; boolean found = false ; while ( first != second && second . next != first ) { if ( ( first . data + second . data ) == x ) { found = true ; System . out . println ( " ( " + first . data + " , ▁ " + second . data + " ) " ) ; first = first . next ; second = second . prev ; } else { if ( ( first . data + second . data ) < x ) first = first . next ; else second = second . prev ; } } if ( found == false ) System . out . println ( " No ▁ pair ▁ found " ) ; } 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 temp ; } public static void main ( String args [ ] ) { 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 = 7 ; pairSum ( head , x ) ; } }

Boolean variables: found
Class/struct names: GFG, Node
Java program:
import java . util . * ; class solution { static class Node { int data ; Node left , right ; } ; static Node newNode ( int data ) { Node node = new Node ( ) ; node . data = data ; node . left = node . right = null ; return ( node ) ; } static void diagonalPrint ( Node root ) { if ( root == null ) return ; Queue < Node > q = new LinkedList < Node > ( ) ; q . add ( root ) ; q . add ( null ) ; while ( q . size ( ) > 0 ) { Node temp = q . peek ( ) ; q . remove ( ) ; if ( temp == null ) { if ( q . size ( ) == 0 ) return ; System . out . println ( ) ; q . add ( null ) ; } else { while ( temp != null ) { System . out . print ( temp . data + " ▁ " ) ; if ( temp . left != null ) q . add ( temp . left ) ; temp = temp . right ; } } } } public static void main ( String args [ ] ) { Node root = newNode ( 8 ) ; root . left = newNode ( 3 ) ; root . right = newNode ( 10 ) ; root . left . left = newNode ( 1 ) ; root . left . right = newNode ( 6 ) ; root . right . right = newNode ( 14 ) ; root . right . right . left = newNode ( 13 ) ; root . left . right . left = newNode ( 4 ) ; root . left . right . right = newNode ( 7 ) ; diagonalPrint ( root ) ; } }

Class/struct names: Node, solution
Java program:
import java . util . * ; class GFG { static class Node { int data ; Node next , prev ; } ; static int countPairs ( Node first , Node second , int value ) { int count = 0 ; while ( first != null && second != null && first != second && second . next != first ) { if ( ( first . data + second . data ) == value ) { count ++ ; first = first . next ; second = second . prev ; } else if ( ( first . data + second . data ) > value ) second = second . prev ; else first = first . next ; } return count ; } static int countTriplets ( Node head , int x ) { if ( head == null ) return 0 ; Node current , first , last ; int count = 0 ; last = head ; while ( last . next != null ) last = last . next ; for ( current = head ; current != null ; current = current . next ) { first = current . next ; count += countPairs ( first , last , x - current . data ) ; } return count ; } 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 ; } public static void main ( String [ ] args ) { 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 = 17 ; System . out . print ( " Count ▁ = ▁ " + countTriplets ( head , x ) ) ; } }

Accumulator variables: count
Iterator variables: current
Class/struct names: GFG, Node
Java program:
class GFG { static class Node { int data ; Node next ; Node prev ; } static Node deleteNode ( Node head_ref , Node del ) { if ( head_ref == null del == null ) return head_ref ; if ( head_ref == del ) head_ref = del . next ; if ( del . next != null ) del . next . prev = del . prev ; if ( del . prev != null ) del . prev . next = del . next ; return head_ref ; } static Node removeDuplicates ( Node head_ref ) { if ( ( head_ref ) == null || ( head_ref ) . next == null ) return head_ref ; ; Node ptr1 , ptr2 ; for ( ptr1 = head_ref ; ptr1 != null ; ptr1 = ptr1 . next ) { ptr2 = ptr1 . next ; while ( ptr2 != null ) { if ( ptr1 . data == ptr2 . data ) { Node next = ptr2 . next ; head_ref = deleteNode ( head_ref , ptr2 ) ; ptr2 = next ; } else ptr2 = ptr2 . next ; } } return head_ref ; } static Node push ( Node head_ref , int new_data ) { Node new_node = new Node ( ) ; new_node . data = new_data ; new_node . prev = null ; new_node . next = ( head_ref ) ; if ( ( head_ref ) != null ) ( head_ref ) . prev = new_node ; ( head_ref ) = new_node ; return head_ref ; } static void printList ( Node head ) { if ( head == null ) System . out . print ( " Doubly ▁ Linked ▁ list ▁ empty " ) ; while ( head != null ) { System . out . print ( head . data + " ▁ " ) ; head = head . next ; } } public static void main ( String args [ ] ) { Node head = null ; head = push ( head , 12 ) ; head = push ( head , 12 ) ; head = push ( head , 10 ) ; head = push ( head , 4 ) ; head = push ( head , 8 ) ; head = push ( head , 4 ) ; head = push ( head , 6 ) ; head = push ( head , 4 ) ; head = push ( head , 4 ) ; head = push ( head , 8 ) ; System . out . print ( "Original Doubly linked list:NEW_LINE"); printList ( head ) ; head = removeDuplicates ( head ) ; System . out . print ( " Doubly linked list after " ▁ + ▁ " removing duplicates : "); printList ( head ) ; } }

Iterator variables: ptr1
Class/struct names: GFG, Node
Java program:
import java . util . * ; class GFG { static class Node { int data ; Node next ; Node prev ; } ; static Node deleteNode ( Node head_ref , Node del ) { if ( head_ref == null del == null ) return null ; if ( head_ref == del ) head_ref = del . next ; if ( del . next != null ) del . next . prev = del . prev ; if ( del . prev != null ) del . prev . next = del . next ; return head_ref ; } static Node removeDuplicates ( Node head_ref ) { if ( ( head_ref ) == null ) return null ; HashSet < Integer > us = new HashSet < > ( ) ; Node current = head_ref , next ; while ( current != null ) { if ( us . contains ( current . data ) ) { next = current . next ; head_ref = deleteNode ( head_ref , current ) ; current = next ; } else { us . add ( current . data ) ; current = current . next ; } } return head_ref ; } static Node push ( Node head_ref , int new_data ) { Node new_node = new Node ( ) ; new_node . data = new_data ; new_node . prev = null ; new_node . next = ( head_ref ) ; if ( ( head_ref ) != null ) ( head_ref ) . prev = new_node ; ( head_ref ) = new_node ; return head_ref ; } static void printList ( Node head ) { if ( head == null ) System . out . print ( " Doubly ▁ Linked ▁ list ▁ empty " ) ; while ( head != null ) { System . out . print ( head . data + " ▁ " ) ; head = head . next ; } } public static void main ( String [ ] args ) { Node head = null ; head = push ( head , 12 ) ; head = push ( head , 12 ) ; head = push ( head , 10 ) ; head = push ( head , 4 ) ; head = push ( head , 8 ) ; head = push ( head , 4 ) ; head = push ( head , 6 ) ; head = push ( head , 4 ) ; head = push ( head , 4 ) ; head = push ( head , 8 ) ; System . out . println ( " Original ▁ Doubly ▁ linked ▁ list : " ) ; printList ( head ) ; head = removeDuplicates ( head ) ; System . out . println ( " Doubly linked list after " ▁ + ▁ " removing duplicates : "); printList ( head ) ; } }

Class/struct names: GFG, Node
Java program:
import java . io . * ; import java . util . * ; class Node { int info ; Node prev , next ; } class GFG { static Node head , tail ; static void nodeInsetail ( int key ) { Node p = new Node ( ) ; p . info = key ; p . next = null ; if ( head == null ) { head = p ; tail = p ; head . prev = null ; return ; } if ( p . info < head . info ) { p . prev = null ; head . prev = p ; p . next = head ; head = p ; return ; } if ( p . info > tail . info ) { p . prev = tail ; tail . next = p ; tail = p ; return ; } Node temp = head . next ; while ( temp . info < p . info ) temp = temp . next ; ( temp . prev ) . next = p ; p . prev = temp . prev ; temp . prev = p ; p . next = temp ; } static void printList ( Node temp ) { while ( temp != null ) { System . out . print ( temp . info + " ▁ " ) ; temp = temp . next ; } } public static void main ( String args [ ] ) { head = tail = null ; nodeInsetail ( 30 ) ; nodeInsetail ( 50 ) ; nodeInsetail ( 90 ) ; nodeInsetail ( 10 ) ; nodeInsetail ( 40 ) ; nodeInsetail ( 110 ) ; nodeInsetail ( 60 ) ; nodeInsetail ( 95 ) ; nodeInsetail ( 23 ) ; System . out . println ( " Doubly ▁ linked ▁ list ▁ on ▁ printing ▁ from ▁ left ▁ to ▁ right " ) ; printList ( head ) ; } }

Class/struct names: GFG, Node
Java program:
import java . util . * ; class GFG { static Node start ; static class Node { int data ; Node next ; Node prev ; } ; static void insertEnd ( int value ) { if ( start == null ) { Node new_node = new Node ( ) ; new_node . data = value ; new_node . next = new_node . prev = new_node ; start = new_node ; return ; } Node last = ( start ) . prev ; Node new_node = new Node ( ) ; new_node . data = value ; new_node . next = start ; ( start ) . prev = new_node ; new_node . prev = last ; last . next = new_node ; } static void insertBegin ( int value ) { Node last = ( start ) . prev ; Node new_node = new Node ( ) ; new_node . data = value ; new_node . next = start ; new_node . prev = last ; last . next = ( start ) . prev = new_node ; start = new_node ; } static void insertAfter ( int value1 , int value2 ) { Node new_node = new Node ( ) ; new_node . data = value1 ; Node temp = start ; while ( temp . data != value2 ) temp = temp . next ; Node next = temp . next ; temp . next = new_node ; new_node . prev = temp ; new_node . next = next ; next . prev = new_node ; } static void display ( ) { Node temp = start ; System . out . printf ( " Traversal in forward direction "); while ( temp . next != start ) { System . out . printf ( " % d ▁ " , temp . data ) ; temp = temp . next ; } System . out . printf ( " % d ▁ " , temp . data ) ; System . out . printf ( " Traversal in reverse direction "); Node last = start . prev ; temp = last ; while ( temp . prev != last ) { System . out . printf ( " % d ▁ " , temp . data ) ; temp = temp . prev ; } System . out . printf ( " % d ▁ " , temp . data ) ; } public static void main ( String [ ] args ) { Node start = null ; insertEnd ( 5 ) ; insertBegin ( 4 ) ; insertEnd ( 7 ) ; insertEnd ( 8 ) ; insertAfter ( 6 , 5 ) ; System . out . printf ( " Created ▁ circular ▁ doubly ▁ linked ▁ list ▁ is : ▁ " ) ; display ( ) ; } }

Class/struct names: GFG, Node
Java program:
class Node { int data ; Node left , right ; Node ( int item ) { data = item ; left = right = null ; } } class BinaryTree { Node root ; void printLeaves ( Node node ) { if ( node == null ) return ; printLeaves ( node . left ) ; if ( node . left == null && node . right == null ) System . out . print ( node . data + " ▁ " ) ; printLeaves ( node . right ) ; } void printBoundaryLeft ( Node node ) { if ( node == null ) return ; if ( node . left != null ) { System . out . print ( node . data + " ▁ " ) ; printBoundaryLeft ( node . left ) ; } else if ( node . right != null ) { System . out . print ( node . data + " ▁ " ) ; printBoundaryLeft ( node . right ) ; } } void printBoundaryRight ( Node node ) { if ( node == null ) return ; if ( node . right != null ) { printBoundaryRight ( node . right ) ; System . out . print ( node . data + " ▁ " ) ; } else if ( node . left != null ) { printBoundaryRight ( node . left ) ; System . out . print ( node . data + " ▁ " ) ; } } void printBoundary ( Node node ) { if ( node == null ) return ; System . out . print ( node . data + " ▁ " ) ; printBoundaryLeft ( node . left ) ; printLeaves ( node . left ) ; printLeaves ( node . right ) ; printBoundaryRight ( node . right ) ; } public static void main ( String args [ ] ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 20 ) ; tree . root . left = new Node ( 8 ) ; 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 ) ; tree . root . right = new Node ( 22 ) ; tree . root . right . right = new Node ( 25 ) ; tree . printBoundary ( tree . root ) ; } }

Class/struct names: BinaryTree, Node
Java program:
import java . io . * ; import java . util . * ; class Node { int data ; Node next ; Node ( int val ) { data = val ; next = null ; } } public class GFG { static void printReverse ( Node head , int n ) { int j = 0 ; Node current = head ; while ( current != null ) { for ( int i = 0 ; i < 2 * ( n - j ) ; i ++ ) System . out . print ( " ▁ " ) ; System . out . print ( " \r " + current . data ) ; current = current . next ; j ++ ; } } static Node push ( Node head , int data ) { Node new_node = new Node ( data ) ; new_node . next = head ; head = new_node ; return head ; } static int printList ( Node head ) { int i = 0 ; Node temp = head ; while ( temp != null ) { System . out . print ( temp . data + " ▁ " ) ; temp = temp . next ; i ++ ; } return i ; } public static void main ( String args [ ] ) { Node head = null ; head = push ( head , 1 ) ; head = push ( head , 2 ) ; head = push ( head , 3 ) ; head = push ( head , 4 ) ; head = push ( head , 5 ) ; head = push ( head , 6 ) ; System . out . println ( " Given ▁ linked ▁ list : ▁ " ) ; int n = printList ( head ) ; System . out . println ( " Reversed ▁ Linked ▁ list : ▁ " ) ; printReverse ( head , n ) ; System . out . println ( ) ; } }

Accumulator variables: i, j
Iterator variables: i
Class/struct names: GFG, Node
Java program:
static class Node { int data ; Node next ; } ;

Class/struct names: Node
Java program:
class GFG { static class Node { int data ; Node next ; } ; static void fun1 ( Node head ) { if ( head == null ) { return ; } fun1 ( head . next ) ; System . out . print ( head . data + " ▁ " ) ; } static void fun2 ( Node start ) { if ( start == null ) { return ; } System . out . print ( start . data + " ▁ " ) ; if ( start . next != null ) { fun2 ( start . next . next ) ; } System . out . print ( start . data + " ▁ " ) ; } static Node push ( Node head_ref , int new_data ) { Node new_node = new Node ( ) ; new_node . data = new_data ; new_node . next = ( head_ref ) ; ( head_ref ) = new_node ; return head_ref ; } public static void main ( String [ ] args ) { Node head = null ; head = push ( head , 5 ) ; head = push ( head , 4 ) ; head = push ( head , 3 ) ; head = push ( head , 2 ) ; head = push ( head , 1 ) ; System . out . print ( " Output ▁ of ▁ fun1 ( ) ▁ for ▁ " + "list 1->2->3->4->5 NEW_LINE"); fun1 ( head ) ; System . out . print ( " Output of fun2 ( ) for " ▁ + ▁ " list 1 -> 2 -> 3 -> 4 -> 5 "); fun2 ( head ) ; } }

Class/struct names: GFG, Node
Java program:
class Node { int data ; Node left , right ; public Node ( int data ) { this . data = data ; left = right = null ; } } class Size { int size = 0 ; } class BinaryTree { Node root ; int heighAndSize ( Node node , Size size ) { if ( node == null ) return 0 ; int l = heighAndSize ( node . left , size ) ; int r = heighAndSize ( node . right , size ) ; size . size ++ ; return ( l > r ) ? l + 1 : r + 1 ; } float density ( Node root ) { Size size = new Size ( ) ; if ( root == null ) return 0 ; int _height = heighAndSize ( root , size ) ; return ( float ) size . size / _height ; } public static void main ( String [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 1 ) ; tree . root . left = new Node ( 2 ) ; tree . root . right = new Node ( 3 ) ; System . out . println ( " Density ▁ of ▁ given ▁ Binary ▁ Tree ▁ is ▁ : ▁ " + tree . density ( tree . root ) ) ; } }

Accumulator variables: size
Class/struct names: BinaryTree, Node, Size
Java program:
class GfG { static class Node { int data ; Node next ; } static Node head = null ; static int printsqrtn ( Node head ) { Node sqrtn = null ; int i = 1 , j = 1 ; while ( head != null ) { if ( i == j * j ) { if ( sqrtn == null ) sqrtn = head ; else sqrtn = sqrtn . next ; j ++ ; } i ++ ; head = head . next ; } return sqrtn . data ; } static void print ( Node head ) { while ( head != null ) { System . out . print ( head . data + " ▁ " ) ; head = head . next ; } System . out . println ( ) ; } static void push ( int new_data ) { Node new_node = new Node ( ) ; new_node . data = new_data ; new_node . next = head ; head = new_node ; } public static void main ( String [ ] args ) { push ( 40 ) ; push ( 30 ) ; push ( 20 ) ; push ( 10 ) ; System . out . print ( " Given ▁ linked ▁ list ▁ is : " ) ; print ( head ) ; System . out . print ( " sqrt ( n ) th ▁ node ▁ is ▁ " + printsqrtn ( head ) ) ; } }

Accumulator variables: i, j
Class/struct names: GfG, Node