dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . io . * ; class GFG { static void rotate ( int [ ] [ ] arr ) { int n = arr . length ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n - i ; j ++ ) { int temp = arr [ i ] [ j ] ; arr [ i ] [ j ] = arr [ n - 1 - j ] [ n - 1 - i ] ; arr [ n - 1 - j ] [ n - 1 - i ] = temp ; } } for ( int i = 0 ; i < n / 2 ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { int temp = arr [ i ] [ j ] ; arr [ i ] [ j ] = arr [ n - 1 - i ] [ j ] ; arr [ n - 1 - i ] [ j ] = temp ; } } } static void printMatrix ( int arr [ ] [ ] ) { int n = arr . length ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) System . out . print ( arr [ i ] [ j ] + " ▁ " ) ; System . out . println ( ) ; } } public static void main ( String [ ] args ) { int arr [ ] [ ] = { { 1 , 2 , 3 , 4 } , { 5 , 6 , 7 , 8 } , { 9 , 10 , 11 , 12 } , { 13 , 14 , 15 , 16 } } ; rotate ( arr ) ; printMatrix ( arr ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void occurredOnce ( int arr [ ] , int n ) { Arrays . sort ( arr ) ; if ( arr [ 0 ] != arr [ 1 ] ) System . out . println ( arr [ 0 ] + " ▁ " ) ; for ( int i = 1 ; i < n - 1 ; i ++ ) if ( arr [ i ] != arr [ i + 1 ] && arr [ i ] != arr [ i - 1 ] ) System . out . print ( arr [ i ] + " ▁ " ) ; if ( arr [ n - 2 ] != arr [ n - 1 ] ) System . out . print ( arr [ n - 1 ] + " ▁ " ) ; } public static void main ( String args [ ] ) { int arr [ ] = { 7 , 7 , 8 , 8 , 9 , 1 , 1 , 4 , 2 , 2 } ; int n = arr . length ; occurredOnce ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; import java . io . * ; class GFG { static void occurredOnce ( int [ ] arr , int n ) { HashMap < Integer , Integer > mp = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( mp . containsKey ( arr [ i ] ) ) mp . put ( arr [ i ] , 1 + mp . get ( arr [ i ] ) ) ; else mp . put ( arr [ i ] , 1 ) ; } for ( Map . Entry entry : mp . entrySet ( ) ) { if ( Integer . parseInt ( String . valueOf ( entry . getValue ( ) ) ) == 1 ) System . out . print ( entry . getKey ( ) + " ▁ " ) ; } } public static void main ( String args [ ] ) { int [ ] arr = { 7 , 7 , 8 , 8 , 9 , 1 , 1 , 4 , 2 , 2 } ; int n = arr . length ; occurredOnce ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void occurredOnce ( int arr [ ] , int n ) { int i = 1 , len = n ; if ( arr [ 0 ] == arr [ len - 1 ] ) { i = 2 ; len -- ; } for ( ; i < n ; i ++ ) if ( arr [ i ] == arr [ i - 1 ] ) i ++ ; else System . out . print ( arr [ i - 1 ] + " ▁ " ) ; if ( arr [ n - 1 ] != arr [ 0 ] && arr [ n - 1 ] != arr [ n - 2 ] ) System . out . print ( arr [ n - 1 ] ) ; } public static void main ( String args [ ] ) { int arr [ ] = { 7 , 7 , 8 , 8 , 9 , 1 , 1 , 4 , 2 , 2 } ; int n = arr . length ; occurredOnce ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i, len
Class/struct names: GFG
Java program:
class Geeks { static void rvereseArray ( int arr [ ] , int start , int end ) { while ( start < end ) { int temp = arr [ start ] ; arr [ start ] = arr [ end ] ; arr [ end ] = temp ; start ++ ; end -- ; } } static void printArray ( int arr [ ] , int size ) { for ( int i = 0 ; i < size ; i ++ ) System . out . print ( arr [ i ] + " ▁ " ) ; } static void splitArr ( int arr [ ] , int k , int n ) { rvereseArray ( arr , 0 , n - 1 ) ; rvereseArray ( arr , 0 , n - k - 1 ) ; rvereseArray ( arr , n - k , n - 1 ) ; } public static void main ( String args [ ] ) { int arr [ ] = { 12 , 10 , 5 , 6 , 52 , 36 } ; int n = arr . length ; int k = 2 ; splitArr ( arr , k , n ) ; printArray ( arr , n ) ; } }

Index/key variables: end, i, start
Accumulator variables: end, i, start
Iterator variables: i
Class/struct names: Geeks
Java program:
import java . util . * ; import java . lang . * ; import java . io . * ; class stringMatching { public static boolean isRotation ( String a , String b ) { int n = a . length ( ) ; int m = b . length ( ) ; if ( n != m ) return false ; int lps [ ] = new int [ n ] ; int len = 0 ; int i = 1 ; lps [ 0 ] = 0 ; while ( i < n ) { if ( a . charAt ( i ) == b . charAt ( len ) ) { lps [ i ] = ++ len ; ++ i ; } else { if ( len == 0 ) { lps [ i ] = 0 ; ++ i ; } else { len = lps [ len - 1 ] ; } } } i = 0 ; for ( int k = lps [ n - 1 ] ; k < m ; ++ k ) { if ( b . charAt ( k ) != a . charAt ( i ++ ) ) return false ; } return true ; } public static void main ( String [ ] args ) { String s1 = " ABACD " ; String s2 = " CDABA " ; System . out . println ( isRotation ( s1 , s2 ) ? "1" : "0" ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: k
Class/struct names: stringMatching
Java program:
import java . io . * ; class GFG { static int countRotationsDivBy8 ( String n ) { int len = n . length ( ) ; int count = 0 ; if ( len == 1 ) { int oneDigit = n . charAt ( 0 ) - '0' ; if ( oneDigit % 8 == 0 ) return 1 ; return 0 ; } if ( len == 2 ) { int first = ( n . charAt ( 0 ) - '0' ) * 10 + ( n . charAt ( 1 ) - '0' ) ; int second = ( n . charAt ( 1 ) - '0' ) * 10 + ( n . charAt ( 0 ) - '0' ) ; if ( first % 8 == 0 ) count ++ ; if ( second % 8 == 0 ) count ++ ; return count ; } int threeDigit ; for ( int i = 0 ; i < ( len - 2 ) ; i ++ ) { threeDigit = ( n . charAt ( i ) - '0' ) * 100 + ( n . charAt ( i + 1 ) - '0' ) * 10 + ( n . charAt ( i + 2 ) - '0' ) ; if ( threeDigit % 8 == 0 ) count ++ ; } threeDigit = ( n . charAt ( len - 1 ) - '0' ) * 100 + ( n . charAt ( 0 ) - '0' ) * 10 + ( n . charAt ( 1 ) - '0' ) ; if ( threeDigit % 8 == 0 ) count ++ ; threeDigit = ( n . charAt ( len - 2 ) - '0' ) * 100 + ( n . charAt ( len - 1 ) - '0' ) * 10 + ( n . charAt ( 0 ) - '0' ) ; if ( threeDigit % 8 == 0 ) count ++ ; return count ; } public static void main ( String [ ] args ) { String n = "43262488612" ; System . out . println ( " Rotations : ▁ " + countRotationsDivBy8 ( n ) ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int minimunMoves ( String arr [ ] , int n ) { int ans = Integer . MAX_VALUE ; for ( int i = 0 ; i < n ; i ++ ) { int curr_count = 0 ; String tmp = " " ; for ( int j = 0 ; j < n ; j ++ ) { tmp = arr [ j ] + arr [ j ] ; int index = tmp . indexOf ( arr [ i ] ) ; if ( index == arr [ i ] . length ( ) ) return - 1 ; curr_count += index ; } ans = Math . min ( curr_count , ans ) ; } return ans ; } public static void main ( String args [ ] ) { String arr [ ] = { " xzzwo " , " zwoxz " , " zzwox " , " xzzwo " } ; int n = arr . length ; System . out . println ( minimunMoves ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: curr_count, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static class Node { int data ; Node next ; } ; static int countRotation ( Node head ) { int count = 0 ; int min = head . data ; while ( head != null ) { if ( min > head . data ) break ; count ++ ; head = head . next ; } return count ; } static Node push ( Node head , int data ) { Node newNode = new Node ( ) ; newNode . data = data ; newNode . next = ( head ) ; ( head ) = newNode ; return head ; } static void printList ( Node node ) { while ( node != null ) { System . out . printf ( " % d ▁ " , node . data ) ; node = node . next ; } } public static void main ( String [ ] args ) { Node head = null ; head = push ( head , 12 ) ; head = push ( head , 11 ) ; head = push ( head , 8 ) ; head = push ( head , 5 ) ; head = push ( head , 18 ) ; head = push ( head , 15 ) ; printList ( head ) ; System . out . println ( ) ; System . out . print ( " Linked ▁ list ▁ rotated ▁ elements : ▁ " ) ; System . out . print ( countRotation ( head ) + "NEW_LINE"); } }

Accumulator variables: count
Class/struct names: GFG, Node
Java program:
import java . util . * ; class GFG { static class Node { int data ; Node next ; } ; static Node tail ; static Node rotateHelper ( Node blockHead , Node blockTail , int d , int k ) { if ( d == 0 ) return blockHead ; if ( d > 0 ) { Node temp = blockHead ; for ( int i = 1 ; temp . next . next != null && i < k - 1 ; i ++ ) temp = temp . next ; blockTail . next = blockHead ; tail = temp ; return rotateHelper ( blockTail , temp , d - 1 , k ) ; } if ( d < 0 ) { blockTail . next = blockHead ; tail = blockHead ; return rotateHelper ( blockHead . next , blockHead , d + 1 , k ) ; } return blockHead ; } static Node rotateByBlocks ( Node head , int k , int d ) { if ( head == null head . next == null ) return head ; if ( d == 0 ) return head ; Node temp = head ; tail = null ; int i ; for ( i = 1 ; temp . next != null && i < k ; i ++ ) temp = temp . next ; Node nextBlock = temp . next ; if ( i < k ) head = rotateHelper ( head , temp , d % k , i ) ; else head = rotateHelper ( head , temp , d % k , k ) ; tail . next = rotateByBlocks ( nextBlock , k , d % k ) ; return head ; } 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 ; } static void printList ( Node node ) { while ( node != null ) { System . out . print ( node . data + " ▁ " ) ; node = node . next ; } } public static void main ( String [ ] args ) { Node head = null ; for ( int i = 9 ; i > 0 ; i -= 1 ) head = push ( head , i ) ; System . out . print ( "Given linked list NEW_LINE"); printList ( head ) ; int k = 3 , d = 2 ; head = rotateByBlocks ( head , k , d ) ; System . out . print ( " Rotated by blocks Linked list "); printList ( head ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG, Node
Java program:
class GFG { static boolean isRotation ( long x , long y ) { long x64 = x | ( x << 32 ) ; while ( x64 >= y ) { if ( x64 == y ) { return true ; } x64 >>= 1 ; } return false ; } public static void main ( String [ ] args ) { long x = 122 ; long y = 2147483678L ; if ( isRotation ( x , y ) == false ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int countRotations ( String n ) { int len = n . length ( ) ; if ( len == 1 ) { int oneDigit = n . charAt ( 0 ) - '0' ; if ( oneDigit % 4 == 0 ) return 1 ; return 0 ; } int twoDigit , count = 0 ; for ( int i = 0 ; i < ( len - 1 ) ; i ++ ) { twoDigit = ( n . charAt ( i ) - '0' ) * 10 + ( n . charAt ( i + 1 ) - '0' ) ; if ( twoDigit % 4 == 0 ) count ++ ; } twoDigit = ( n . charAt ( len - 1 ) - '0' ) * 10 + ( n . charAt ( 0 ) - '0' ) ; if ( twoDigit % 4 == 0 ) count ++ ; return count ; } public static void main ( String args [ ] ) { String n = "4834" ; System . out . println ( " Rotations : ▁ " + countRotations ( n ) ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
Java program:
class Test { static boolean isRotated ( String str1 , String str2 ) { if ( str1 . length ( ) != str2 . length ( ) ) return false ; if ( str1 . length ( ) < 2 ) { return str1 . equals ( str2 ) ; } String clock_rot = " " ; String anticlock_rot = " " ; int len = str2 . length ( ) ; anticlock_rot = anticlock_rot + str2 . substring ( len - 2 , len ) + str2 . substring ( 0 , len - 2 ) ; clock_rot = clock_rot + str2 . substring ( 2 ) + str2 . substring ( 0 , 2 ) ; return ( str1 . equals ( clock_rot ) || str1 . equals ( anticlock_rot ) ) ; } public static void main ( String [ ] args ) { String str1 = " geeks " ; String str2 = " eksge " ; System . out . println ( isRotated ( str1 , str2 ) ? " Yes " : " No " ) ; } }

Class/struct names: Test
Java program:
import java . util . * ; class GFG { static String minLexRotation ( String str ) { int n = str . length ( ) ; String arr [ ] = new String [ n ] ; String concat = str + str ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = concat . substring ( i , i + n ) ; } Arrays . sort ( arr ) ; return arr [ 0 ] ; } public static void main ( String [ ] args ) { System . out . println ( minLexRotation ( " GEEKSFORGEEKS " ) ) ; System . out . println ( minLexRotation ( " GEEKSQUIZ " ) ) ; System . out . println ( minLexRotation ( " BCABDADAB " ) ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static Node head ; static class Node { int data ; Node next ; public Node ( int data ) { this . data = data ; this . next = null ; } } static void print ( Node head ) { Node temp = head ; while ( temp != null ) { System . out . print ( temp . data + " ▁ " ) ; temp = temp . next ; } } static void NextGreaterElement ( Node head ) { Node H = head ; Node res = null ; Node tempList = null ; do { Node curr = head ; int Val = - 1 ; do { if ( head . data < curr . data ) { Val = curr . data ; break ; } curr = curr . next ; } while ( curr != head ) ; if ( res == null ) { res = new Node ( Val ) ; tempList = res ; } else { tempList . next = new Node ( Val ) ; tempList = tempList . next ; } head = head . next ; } while ( head != H ) ; print ( res ) ; } public static void main ( String [ ] args ) { head = new Node ( 1 ) ; head . next = new Node ( 5 ) ; head . next . next = new Node ( 12 ) ; head . next . next . next = new Node ( 10 ) ; head . next . next . next . next = new Node ( 0 ) ; head . next . next . next . next . next = head ; NextGreaterElement ( head ) ; } }

Class/struct names: GFG, Node
Java program:
class GFG { static class Node { int data ; Node next ; } ; static void printList ( Node n ) { while ( n != null ) { System . out . print ( n . data + " ▁ " ) ; n = n . next ; } } public static void main ( String [ ] args ) { Node head = null ; Node second = null ; Node third = null ; head = new Node ( ) ; second = new Node ( ) ; third = new Node ( ) ; head . data = 1 ; head . next = second ; second . data = 2 ; second . next = third ; third . data = 3 ; third . next = null ; printList ( head ) ; } }

Class/struct names: GFG, Node
Java program:
static class Node { int data ; Node next ; Node prev ; } ;

Class/struct names: Node
Java program:
class GFG { static class Node { int data ; Node next ; } ; static Node push ( Node head_ref , int data ) { Node ptr1 = new Node ( ) ; Node temp = head_ref ; ptr1 . data = data ; ptr1 . next = head_ref ; if ( head_ref != null ) { while ( temp . next != head_ref ) temp = temp . next ; temp . next = ptr1 ; } else ptr1 . next = ptr1 ; head_ref = ptr1 ; return head_ref ; } static void deleteNode ( Node head_ref , Node del ) { if ( head_ref == del ) head_ref = del . next ; Node temp = head_ref ; while ( temp . next != del ) { temp = temp . next ; } temp . next = del . next ; System . gc ( ) ; return ; } static boolean isEvenParity ( int x ) { int parity = 0 ; while ( x != 0 ) { if ( ( x & 1 ) != 0 ) parity ++ ; x = x >> 1 ; } if ( parity % 2 == 0 ) return true ; else return false ; } static void deleteEvenParityNodes ( Node head ) { if ( head == null ) return ; if ( head == head . next ) { if ( isEvenParity ( head . data ) ) head = null ; return ; } Node ptr = head ; Node next ; do { next = ptr . next ; if ( isEvenParity ( ptr . data ) ) deleteNode ( head , ptr ) ; ptr = next ; } while ( ptr != head ) ; if ( head == head . next ) { if ( isEvenParity ( head . data ) ) head = null ; return ; } } static void printList ( Node head ) { if ( head == null ) { System . out . print ( "Empty ListNEW_LINE"); return ; } Node temp = head ; if ( head != null ) { do { System . out . printf ( " % d ▁ " , temp . data ) ; temp = temp . next ; } while ( temp != head ) ; } } public static void main ( String [ ] args ) { Node head = null ; head = push ( head , 21 ) ; head = push ( head , 13 ) ; head = push ( head , 6 ) ; head = push ( head , 34 ) ; head = push ( head , 9 ) ; head = push ( head , 11 ) ; deleteEvenParityNodes ( head ) ; printList ( head ) ; } }

Accumulator variables: parity
Class/struct names: GFG, Node
Java program:
import java . util . * ; class GFG { static class Node { int data ; Node next ; } ; static Node push ( Node head_ref , int data ) { Node ptr1 = new Node ( ) ; Node temp = head_ref ; ptr1 . data = data ; ptr1 . next = head_ref ; if ( head_ref != null ) { while ( temp . next != head_ref ) temp = temp . next ; temp . next = ptr1 ; } else ptr1 . next = ptr1 ; head_ref = ptr1 ; return head_ref ; } static void deleteNode ( Node head_ref , Node del ) { Node temp = head_ref ; if ( head_ref == del ) head_ref = del . next ; while ( temp . next != del ) { temp = temp . next ; } temp . next = del . next ; del = null ; return ; } static int digitSum ( int num ) { int sum = 0 ; while ( num > 0 ) { sum += ( num % 10 ) ; num /= 10 ; } return sum ; } static void deleteEvenDigitSumNodes ( Node head ) { Node ptr = head ; Node next ; do { if ( ! ( digitSum ( ptr . data ) % 2 == 1 ) ) deleteNode ( head , ptr ) ; next = ptr . next ; ptr = next ; } while ( ptr != head ) ; } static void printList ( Node head ) { Node temp = head ; if ( head != null ) { do { System . out . printf ( " % d ▁ " , temp . data ) ; temp = temp . next ; } while ( temp != head ) ; } } public static void main ( String [ ] args ) { Node head = null ; head = push ( head , 21 ) ; head = push ( head , 13 ) ; head = push ( head , 6 ) ; head = push ( head , 34 ) ; head = push ( head , 11 ) ; head = push ( head , 9 ) ; deleteEvenDigitSumNodes ( head ) ; printList ( head ) ; } }

Accumulator variables: num, sum
Class/struct names: GFG, Node
Java program:
import java . util . * ; class GFG { static class Node { int data ; Node next ; } ; static Node push ( Node head_ref , int data ) { Node ptr1 = new Node ( ) ; Node temp = head_ref ; ptr1 . data = data ; ptr1 . next = head_ref ; if ( head_ref != null ) { while ( temp . next != head_ref ) temp = temp . next ; temp . next = ptr1 ; } else ptr1 . next = ptr1 ; head_ref = ptr1 ; return head_ref ; } static void deleteNode ( Node head_ref , Node del ) { Node temp = head_ref ; if ( head_ref == del ) head_ref = del . next ; while ( temp . next != del ) { temp = temp . next ; } temp . next = del . next ; del = null ; return ; } static int largestElement ( Node head_ref ) { Node current ; current = head_ref ; int maxEle = Integer . MIN_VALUE ; do { if ( current . data > maxEle ) { maxEle = current . data ; } current = current . next ; } while ( current != head_ref ) ; return maxEle ; } static void createHash ( HashSet < Integer > hash , int maxElement ) { int prev = 0 , curr = 1 ; hash . add ( prev ) ; hash . add ( curr ) ; while ( curr <= maxElement ) { int temp = curr + prev ; hash . add ( temp ) ; prev = curr ; curr = temp ; } } static void deleteFibonacciNodes ( Node head ) { int maxEle = largestElement ( head ) ; HashSet < Integer > hash = new HashSet < Integer > ( ) ; createHash ( hash , maxEle ) ; Node ptr = head ; Node next ; do { if ( hash . contains ( ptr . data ) ) deleteNode ( head , ptr ) ; next = ptr . next ; ptr = next ; } while ( ptr != head ) ; } static void printList ( Node head ) { Node temp = head ; if ( head != null ) { do { System . out . printf ( " % d ▁ " , temp . data ) ; temp = temp . next ; } while ( temp != head ) ; } } public static void main ( String [ ] args ) { Node head = null ; head = push ( head , 20 ) ; head = push ( head , 13 ) ; head = push ( head , 6 ) ; head = push ( head , 34 ) ; head = push ( head , 11 ) ; head = push ( head , 9 ) ; deleteFibonacciNodes ( head ) ; printList ( head ) ; } }

Class/struct names: GFG, Node
Java program:
class GFG { static class Node { int data ; Node next ; } ; static Node push ( Node head_ref , int data ) { Node ptr1 = new Node ( ) ; Node temp = head_ref ; ptr1 . data = data ; ptr1 . next = head_ref ; if ( head_ref != null ) { while ( temp . next != head_ref ) temp = temp . next ; temp . next = ptr1 ; return head_ref ; } else ptr1 . next = ptr1 ; head_ref = ptr1 ; return head_ref ; } static Node deleteNode ( Node head_ref , Node del ) { Node temp = head_ref ; if ( head_ref == del ) head_ref = del . next ; while ( temp . next != del ) { temp = temp . next ; } temp . next = del . next ; return head_ref ; } static Node deleteoddNodes ( Node head ) { Node ptr = head ; Node next ; do { if ( ptr . data % 2 == 1 ) deleteNode ( head , ptr ) ; next = ptr . next ; ptr = next ; } while ( ptr != head ) ; return head ; } static void printList ( Node head ) { Node temp = head ; if ( head != null ) { do { System . out . printf ( " % d ▁ " , temp . data ) ; temp = temp . next ; } while ( temp != head ) ; } } public static void main ( String args [ ] ) { Node head = null ; head = push ( head , 2 ) ; head = push ( head , 12 ) ; head = push ( head , 11 ) ; head = push ( head , 57 ) ; head = push ( head , 61 ) ; head = push ( head , 56 ) ; System . out . println ( " List after deletion : "); head = deleteoddNodes ( head ) ; printList ( head ) ; } }

Class/struct names: GFG, Node
Java program:
import java . util . * ; import java . lang . * ; import java . io . * ; class GFG { static class Node { Node next ; int data ; } ; static Node create ( ) { Node new_node = new Node ( ) ; new_node . next = null ; return new_node ; } static Node find_head ( Node random ) { if ( random == null ) return null ; Node head , var = random ; while ( ! ( var . data > var . next . data var . next == random ) ) { var = var . next ; } return var . next ; } static Node sortedInsert ( Node head_ref , Node new_node ) { Node current = head_ref ; if ( current == null ) { new_node . next = new_node ; head_ref = new_node ; } else if ( current . data >= new_node . data ) { while ( current . next != head_ref ) current = current . next ; current . next = new_node ; new_node . next = head_ref ; head_ref = new_node ; } else { while ( current . next != head_ref && current . next . data < new_node . data ) { current = current . next ; } new_node . next = current . next ; current . next = new_node ; } return head_ref ; } static void printList ( Node start ) { Node temp ; if ( start != null ) { temp = start ; do { System . out . print ( temp . data + " ▁ " ) ; temp = temp . next ; } while ( temp != start ) ; } } public static void main ( String args [ ] ) { int arr [ ] = { 12 , 56 , 2 , 11 , 1 , 90 } ; int list_size , i ; Node start = null ; Node temp ; for ( i = 0 ; i < 6 ; i ++ ) { if ( start != null ) for ( int j = 0 ; j < ( Math . random ( ) * 10 ) ; j ++ ) start = start . next ; temp = create ( ) ; temp . data = arr [ i ] ; start = sortedInsert ( find_head ( start ) , temp ) ; } printList ( find_head ( start ) ) ; } }

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