dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
using namespace std ; class Node { public : int data ; Node * next ; } ; Node * rotateHelper ( Node * blockHead , Node * blockTail , int d , Node * * tail , int k ) { if ( d == 0 ) return blockHead ; if ( d > 0 ) { Node * temp = blockHead ; for ( int i = 1 ; temp -> next -> next && i < k - 1 ; i ++ ) temp = temp -> next ; blockTail -> next = blockHead ; * tail = temp ; return rotateHelper ( blockTail , temp , d - 1 , tail , k ) ; } if ( d < 0 ) { blockTail -> next = blockHead ; * tail = blockHead ; return rotateHelper ( blockHead -> next , blockHead , d + 1 , tail , k ) ; } } Node * rotateByBlocks ( Node * head , int k , int d ) { if ( ! head ! head -> next ) return head ; if ( d == 0 ) return head ; Node * temp = head , * tail = NULL ; int i ; for ( i = 1 ; temp -> next && i < k ; i ++ ) temp = temp -> next ; Node * nextBlock = temp -> next ; if ( i < k ) head = rotateHelper ( head , temp , d % k , & tail , i ) ; else head = rotateHelper ( head , temp , d % k , & tail , k ) ; tail -> next = rotateByBlocks ( nextBlock , k , d % k ) ; return head ; } void 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 ; } void printList ( Node * node ) { while ( node != NULL ) { cout << node -> data << " ▁ " ; node = node -> next ; } } int main ( ) { Node * head = NULL ; for ( int i = 9 ; i > 0 ; i -= 1 ) push ( & head , i ) ; cout << " Given ▁ linked ▁ list ▁ STRNEWLINE " ; printList ( head ) ; int k = 3 , d = 2 ; head = rotateByBlocks ( head , k , d ) ; cout << " Rotated by blocks Linked list " ; printList ( head ) ; return ( 0 ) ; }

Accumulator variables: i, stdc
Iterator variables: i
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countRotations ( string n ) { int len = n . length ( ) ; if ( len == 1 ) { int oneDigit = n . at ( 0 ) - '0' ; if ( oneDigit % 4 == 0 ) return 1 ; return 0 ; } int twoDigit , count = 0 ; for ( int i = 0 ; i < ( len - 1 ) ; i ++ ) { twoDigit = ( n . at ( i ) - '0' ) * 10 + ( n . at ( i + 1 ) - '0' ) ; if ( twoDigit % 4 == 0 ) count ++ ; } twoDigit = ( n . at ( len - 1 ) - '0' ) * 10 + ( n . at ( 0 ) - '0' ) ; if ( twoDigit % 4 == 0 ) count ++ ; return count ; } int main ( ) { string n = "4834" ; cout << " Rotations : ▁ " << countRotations ( n ) << endl ; return 0 ; }

Accumulator variables: count, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isRotated ( string str1 , string str2 ) { if ( str1 . length ( ) != str2 . length ( ) ) return false ; if ( str1 . length ( ) < 2 ) { return str1 . compare ( str2 ) == 0 ; } string clock_rot = " " ; string anticlock_rot = " " ; int len = str2 . length ( ) ; anticlock_rot = anticlock_rot + str2 . substr ( len - 2 , 2 ) + str2 . substr ( 0 , len - 2 ) ; clock_rot = clock_rot + str2 . substr ( 2 ) + str2 . substr ( 0 , 2 ) ; return ( str1 . compare ( clock_rot ) == 0 || str1 . compare ( anticlock_rot ) == 0 ) ; } int main ( ) { string str1 = " geeks " ; string str2 = " eksge " ; isRotated ( str1 , str2 ) ? cout << " Yes " : cout << " No " ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <iostream>
#include <algorithm>
using namespace std ; string minLexRotation ( string str ) { int n = str . length ( ) ; string arr [ n ] ; string concat = str + str ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = concat . substr ( i , n ) ; sort ( arr , arr + n ) ; return arr [ 0 ] ; } int main ( ) { cout << minLexRotation ( " GEEKSFORGEEKS " ) << endl ; cout << minLexRotation ( " GEEKSQUIZ " ) << endl ; cout << minLexRotation ( " BCABDADAB " ) << endl ; }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { int data ; Node * next ; Node ( int d ) { data = d ; next = NULL ; } } ; void print ( Node * head ) { Node * temp = head ; while ( temp != NULL ) { cout << temp -> data << " ▁ " ; temp = temp -> next ; } } 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 ) ; } int main ( ) { Node * 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 ) ; return 0 ; }

Accumulator variables: stdc
Class/struct names: Node
C++ program:
class Node { public : int data ; Node * next ; } ;

Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; class Node { public : int data ; Node * next ; } ; void printList ( Node * n ) { while ( n != NULL ) { cout << n -> data << " ▁ " ; n = n -> next ; } } int main ( ) { 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 ) ; return 0 ; }

Accumulator variables: stdc
Class/struct names: Node
C++ program:
struct Node { int data ; struct Node * next ; struct Node * prev ; } ;

Class/struct names: Node
C++ program:
struct link { int info ; struct link * next ; } ;

Class/struct names: link
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { int data ; Node * prev , * next ; } ; void push ( Node * * head_ref , int new_data ) { Node * new_node = ( Node * ) malloc ( sizeof ( struct 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 ; } bool isEvenParity ( int x ) { int parity = 0 ; while ( x != 0 ) { if ( x & 1 ) parity ++ ; x = x >> 1 ; } if ( parity % 2 == 0 ) return true ; else return false ; } void deleteNode ( Node * * head_ref , Node * del ) { if ( * head_ref == NULL del == NULL ) return ; 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 ; free ( del ) ; return ; } void deleteEvenParityNodes ( Node * * head_ref ) { Node * ptr = * head_ref ; Node * next ; while ( ptr != NULL ) { next = ptr -> next ; if ( isEvenParity ( ptr -> data ) ) deleteNode ( head_ref , ptr ) ; ptr = next ; } } void printList ( Node * head ) { if ( head == NULL ) { cout << " Empty ▁ list STRNEWLINE " ; return ; } while ( head != NULL ) { cout << head -> data << " ▁ " ; head = head -> next ; } } int main ( ) { Node * head = NULL ; push ( & head , 14 ) ; push ( & head , 9 ) ; push ( & head , 8 ) ; push ( & head , 15 ) ; push ( & head , 18 ) ; deleteEvenParityNodes ( & head ) ; printList ( head ) ; }

Accumulator variables: parity, stdc
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { int data ; struct Node * next ; } ; void push ( struct Node * * head_ref , int data ) { struct Node * ptr1 = ( struct Node * ) malloc ( sizeof ( struct Node ) ) ; struct 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 ; } void deleteNode ( Node * & head_ref , Node * del ) { if ( head_ref == del ) head_ref = del -> next ; struct Node * temp = head_ref ; while ( temp -> next != del ) { temp = temp -> next ; } temp -> next = del -> next ; free ( del ) ; return ; } bool isEvenParity ( int x ) { int parity = 0 ; while ( x != 0 ) { if ( x & 1 ) parity ++ ; x = x >> 1 ; } if ( parity % 2 == 0 ) return true ; else return false ; } void deleteEvenParityNodes ( Node * & head ) { if ( head == NULL ) return ; if ( head == head -> next ) { if ( isEvenParity ( head -> data ) ) head = NULL ; return ; } struct Node * ptr = head ; struct 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 ; } } void printList ( struct Node * head ) { if ( head == NULL ) { cout << " Empty ▁ List STRNEWLINE " ; return ; } struct Node * temp = head ; if ( head != NULL ) { do { printf ( " % d ▁ " , temp -> data ) ; temp = temp -> next ; } while ( temp != head ) ; } } int main ( ) { struct Node * head = NULL ; push ( & head , 21 ) ; push ( & head , 13 ) ; push ( & head , 6 ) ; push ( & head , 34 ) ; push ( & head , 9 ) ; push ( & head , 11 ) ; deleteEvenParityNodes ( head ) ; printList ( head ) ; return 0 ; }

Accumulator variables: parity, stdc
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { int data ; struct Node * next ; } ; void push ( struct Node * * head_ref , int data ) { struct Node * ptr1 = ( struct Node * ) malloc ( sizeof ( struct Node ) ) ; struct 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 ; } void deleteNode ( Node * head_ref , Node * del ) { struct Node * temp = head_ref ; if ( head_ref == del ) head_ref = del -> next ; while ( temp -> next != del ) { temp = temp -> next ; } temp -> next = del -> next ; free ( del ) ; return ; } int digitSum ( int num ) { int sum = 0 ; while ( num ) { sum += ( num % 10 ) ; num /= 10 ; } return sum ; } void deleteEvenDigitSumNodes ( Node * head ) { struct Node * ptr = head ; struct Node * next ; do { if ( ! ( digitSum ( ptr -> data ) & 1 ) ) deleteNode ( head , ptr ) ; next = ptr -> next ; ptr = next ; } while ( ptr != head ) ; } void printList ( struct Node * head ) { struct Node * temp = head ; if ( head != NULL ) { do { printf ( " % d ▁ " , temp -> data ) ; temp = temp -> next ; } while ( temp != head ) ; } } int main ( ) { struct Node * head = NULL ; push ( & head , 21 ) ; push ( & head , 13 ) ; push ( & head , 6 ) ; push ( & head , 34 ) ; push ( & head , 11 ) ; push ( & head , 9 ) ; deleteEvenDigitSumNodes ( head ) ; printList ( head ) ; return 0 ; }

Accumulator variables: num, stdc, sum
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { int data ; struct Node * next ; } ; void push ( struct Node * * head_ref , int data ) { struct Node * ptr1 = ( struct Node * ) malloc ( sizeof ( struct Node ) ) ; struct 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 ; } void deleteNode ( Node * head_ref , Node * del ) { struct Node * temp = head_ref ; if ( head_ref == del ) head_ref = del -> next ; while ( temp -> next != del ) { temp = temp -> next ; } temp -> next = del -> next ; free ( del ) ; return ; } int largestElement ( struct Node * head_ref ) { struct Node * current ; current = head_ref ; int maxEle = INT_MIN ; do { if ( current -> data > maxEle ) { maxEle = current -> data ; } current = current -> next ; } while ( current != head_ref ) ; return maxEle ; } void createHash ( set < int > & hash , int maxElement ) { int prev = 0 , curr = 1 ; hash . insert ( prev ) ; hash . insert ( curr ) ; while ( curr <= maxElement ) { int temp = curr + prev ; hash . insert ( temp ) ; prev = curr ; curr = temp ; } } void deleteFibonacciNodes ( Node * head ) { int maxEle = largestElement ( head ) ; set < int > hash ; createHash ( hash , maxEle ) ; struct Node * ptr = head ; struct Node * next ; do { if ( hash . find ( ptr -> data ) != hash . end ( ) ) deleteNode ( head , ptr ) ; next = ptr -> next ; ptr = next ; } while ( ptr != head ) ; } void printList ( struct Node * head ) { struct Node * temp = head ; if ( head != NULL ) { do { printf ( " % d ▁ " , temp -> data ) ; temp = temp -> next ; } while ( temp != head ) ; } } int main ( ) { struct Node * head = NULL ; push ( & head , 20 ) ; push ( & head , 13 ) ; push ( & head , 6 ) ; push ( & head , 34 ) ; push ( & head , 11 ) ; push ( & head , 9 ) ; deleteFibonacciNodes ( head ) ; printList ( head ) ; return 0 ; }

Accumulator variables: stdc
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { int data ; struct Node * next ; } ; void push ( struct Node * * head_ref , int data ) { struct Node * ptr1 = ( struct Node * ) malloc ( sizeof ( struct Node ) ) ; struct 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 ; } void deleteNode ( Node * head_ref , Node * del ) { struct Node * temp = head_ref ; if ( head_ref == del ) head_ref = del -> next ; while ( temp -> next != del ) { temp = temp -> next ; } temp -> next = del -> next ; free ( del ) ; return ; } void deleteoddNodes ( Node * head ) { struct Node * ptr = head ; struct Node * next ; do { if ( ( ptr -> data % 2 ) == 1 ) deleteNode ( head , ptr ) ; next = ptr -> next ; ptr = next ; } while ( ptr != head ) ; } void printList ( struct Node * head ) { struct Node * temp = head ; if ( head != NULL ) { do { printf ( " % d ▁ " , temp -> data ) ; temp = temp -> next ; } while ( temp != head ) ; } } int main ( ) { struct Node * head = NULL ; push ( & head , 2 ) ; push ( & head , 12 ) ; push ( & head , 11 ) ; push ( & head , 57 ) ; push ( & head , 61 ) ; push ( & head , 56 ) ; cout << " List after deletion : " ; deleteoddNodes ( head ) ; printList ( head ) ; return 0 ; }

Accumulator variables: stdc
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { Node * next ; int data ; } ; Node * create ( ) { Node * new_node = ( Node * ) malloc ( sizeof ( Node ) ) ; new_node -> next = NULL ; return new_node ; } 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 ; } 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 ; } void printList ( Node * start ) { Node * temp ; if ( start != NULL ) { temp = start ; do { cout << temp -> data << " ▁ " ; temp = temp -> next ; } while ( temp != start ) ; } } int main ( ) { 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 < ( rand ( ) % 10 ) ; j ++ ) start = start -> next ; temp = create ( ) ; temp -> data = arr [ i ] ; start = sortedInsert ( find_head ( start ) , temp ) ; } printList ( find_head ( start ) ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, j, stdc
Iterator variables: i, j
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; class CircularLinkedList { public : struct Node { int data ; Node * next ; } ; Node * last ; Node * addToEmpty ( int data ) { if ( last != NULL ) return last ; Node * temp = new Node ( ) ; temp -> data = data ; last = temp ; last -> next = last ; return last ; } Node * addBegin ( int data ) { if ( last == NULL ) return addToEmpty ( data ) ; Node * temp = new Node ( ) ; temp -> data = data ; temp -> next = last -> next ; last -> next = temp ; return last ; } void traverse ( ) { Node * p ; if ( last == NULL ) { cout << ( " List ▁ is ▁ empty . " ) ; return ; } p = last -> next ; do { cout << p -> data << " ▁ " ; p = p -> next ; } while ( p != last -> next ) ; cout << endl ; } int length ( ) { int x = 0 ; if ( last == NULL ) return x ; Node * itr = last -> next ; while ( itr -> next != last -> next ) { x ++ ; itr = itr -> next ; } return ( x + 1 ) ; } Node * split ( int k ) { Node * pass = new Node ( ) ; if ( last == NULL ) return last ; Node * newLast , * itr = last ; for ( int i = 0 ; i < k ; i ++ ) { itr = itr -> next ; } newLast = itr ; pass -> next = itr -> next ; newLast -> next = last -> next ; last -> next = pass -> next ; return newLast ; } } ; int main ( ) { CircularLinkedList * clist = new CircularLinkedList ( ) ; clist -> last = NULL ; clist -> addToEmpty ( 12 ) ; clist -> addBegin ( 10 ) ; clist -> addBegin ( 8 ) ; clist -> addBegin ( 6 ) ; clist -> addBegin ( 4 ) ; clist -> addBegin ( 2 ) ; cout << ( " Original ▁ list : " ) ; clist -> traverse ( ) ; int k = 4 ; CircularLinkedList * clist2 = new CircularLinkedList ( ) ; clist2 -> last = clist -> split ( k ) ; cout << ( " The ▁ new ▁ lists ▁ are : " ) ; clist2 -> traverse ( ) ; clist -> traverse ( ) ; }

Accumulator variables: i, stdc, x
Iterator variables: i
Class/struct names: CircularLinkedList, Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { int data ; struct Node * left ; struct Node * right ; Node ( int x ) { data = x ; left = right = NULL ; } } ; void inorder ( Node * root , vector < int > & v ) { if ( ! root ) return ; inorder ( root -> left , v ) ; v . push_back ( root -> data ) ; inorder ( root -> right , v ) ; } Node * bTreeToCList ( Node * root ) { if ( root == NULL ) return NULL ; vector < int > v ; inorder ( root , v ) ; Node * head_ref = new Node ( v [ 0 ] ) ; Node * curr = head_ref ; for ( int i = 1 ; i < v . size ( ) ; i ++ ) { Node * temp = curr ; curr -> right = new Node ( v [ i ] ) ; curr = curr -> right ; curr -> left = temp ; } curr -> right = head_ref ; head_ref -> left = curr ; return head_ref ; } void displayCList ( Node * head ) { cout << " Circular ▁ Doubly ▁ Linked ▁ List ▁ is ▁ : STRNEWLINE " ; Node * itr = head ; do { cout << itr -> data << " ▁ " ; itr = itr -> right ; } while ( head != itr ) ; cout << " STRNEWLINE " ; } int main ( ) { Node * root = new Node ( 10 ) ; root -> left = new Node ( 12 ) ; root -> right = new Node ( 15 ) ; root -> left -> left = new Node ( 25 ) ; root -> left -> right = new Node ( 30 ) ; root -> right -> left = new Node ( 36 ) ; Node * head = bTreeToCList ( root ) ; displayCList ( head ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
Class/struct names: Node
C++ program:
void DeleteAllOddNode ( struct Node * * head ) { int len = Length ( * head ) ; int count = 0 ; struct Node * previous = * head , * next = * head ; if ( * head == NULL ) { printf ( " Delete Last List is empty " return ; } if ( len == 1 ) { DeleteFirst ( head ) ; return ; } while ( len > 0 ) { if ( count == 0 ) { DeleteFirst ( head ) ; } if ( count % 2 == 0 && count != 0 ) { deleteNode ( * head , previous ) ; } previous = previous -> next ; next = previous -> next ; len -- ; count ++ ; } return ; }

Accumulator variables: count, len
Class/struct names: Node
C++ program:
void DeleteAllEvenNode ( struct Node * * head ) { int len = Length ( * head ) ; int count = 1 ; struct Node * previous = * head , * next = * head ; if ( * head == NULL ) { printf ( " List is empty " return ; } if ( len < 2 ) { return ; } previous = * head ; next = previous -> next ; while ( len > 0 ) { if ( count % 2 == 0 ) { previous -> next = next -> next ; free ( next ) ; previous = next -> next ; next = previous -> next ; } len -- ; count ++ ; } return ; }

Accumulator variables: count, len
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { int data ; struct Node * next ; } ; void printMinMax ( struct Node * * head ) { if ( * head == NULL ) { return ; } struct Node * current ; current = * head ; int min = INT_MAX , max = INT_MIN ; do { if ( current -> data < min ) { min = current -> data ; } if ( current -> data > max ) { max = current -> data ; } current = current -> next ; } while ( current != head ) ; cout << " Minimum = " ▁ < < ▁ min ▁ < < ▁ " , Maximum = " } void insertNode ( struct Node * * head , int data ) { struct Node * current = * head ; struct Node * newNode = new Node ; if ( ! newNode ) { printf ( " Memory Error " return ; } newNode -> data = data ; if ( * head == NULL ) { newNode -> next = newNode ; * head = newNode ; return ; } else { while ( current -> next != * head ) { current = current -> next ; } newNode -> next = * head ; current -> next = newNode ; } } void displayList ( struct Node * head ) { struct Node * current = head ; if ( head == NULL ) { printf ( " Display List is empty " return ; } else { do { printf ( " % d ▁ " , current -> data ) ; current = current -> next ; } while ( current != head ) ; } } int main ( ) { struct Node * Head = NULL ; insertNode ( & Head , 99 ) ; insertNode ( & Head , 11 ) ; insertNode ( & Head , 22 ) ; insertNode ( & Head , 33 ) ; insertNode ( & Head , 44 ) ; insertNode ( & Head , 55 ) ; insertNode ( & Head , 66 ) ; cout << " Initial ▁ List : ▁ " ; displayList ( Head ) ; printMinMax ( & Head ) ; return 0 ; }

Accumulator variables: stdc
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { int data ; struct Node * next ; } ; void push ( struct Node * * head_ref , int data ) { struct Node * ptr1 = ( struct Node * ) malloc ( sizeof ( struct Node ) ) ; struct 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 ; } void deleteNode ( Node * head_ref , Node * del ) { struct Node * temp = head_ref ; if ( head_ref == del ) head_ref = del -> next ; while ( temp -> next != del ) { temp = temp -> next ; } temp -> next = del -> next ; free ( del ) ; return ; } void deleteEvenNodes ( Node * head ) { struct Node * ptr = head ; struct Node * next ; do { if ( ptr -> data % 2 == 0 ) deleteNode ( head , ptr ) ; next = ptr -> next ; ptr = next ; } while ( ptr != head ) ; } void printList ( struct Node * head ) { struct Node * temp = head ; if ( head != NULL ) { do { printf ( " % d ▁ " , temp -> data ) ; temp = temp -> next ; } while ( temp != head ) ; } } int main ( ) { struct Node * head = NULL ; push ( & head , 61 ) ; push ( & head , 12 ) ; push ( & head , 56 ) ; push ( & head , 2 ) ; push ( & head , 11 ) ; push ( & head , 57 ) ; cout << " List after deletion : " ; deleteEvenNodes ( head ) ; printList ( head ) ; return 0 ; }

Accumulator variables: stdc
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { int data ; struct Node * next ; } ; void push ( struct Node * * head_ref , int data ) { struct Node * ptr1 = ( struct Node * ) malloc ( sizeof ( struct Node ) ) ; struct 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 ; } int sumOfList ( struct Node * head ) { struct Node * temp = head ; int sum = 0 ; if ( head != NULL ) { do { temp = temp -> next ; sum += temp -> data ; } while ( temp != head ) ; } return sum ; } int main ( ) { struct Node * head = NULL ; push ( & head , 12 ) ; push ( & head , 56 ) ; push ( & head , 2 ) ; push ( & head , 11 ) ; cout << " Sum ▁ of ▁ Circular ▁ linked ▁ list ▁ is ▁ = ▁ " << sumOfList ( head ) ; return 0 ; }

Accumulator variables: stdc, sum
Class/struct names: Node