Reverse a Linked List in groups of given size

Problem Description: Given a linked list, write a function to reverse every k nodes (where k is an input to the function).Ifalinked list is givenas1->2->3->4->5->6->7->8->NULL and k = 3 then output will be3->2->1->6->5->4->8->7->NULL. Input: In this problem,method takes two argument: the head of the linked list and int k. You should not read any input

Delete nodes having greater value on right

Problem description: Given a singly linked list, remove all the nodes which have a greater value on right side. Input: You have to complete the method which takes 1argument: the head of the linked list .You should not read any input from stdin/console.There are multiple test cases. For each test case, this method will be

Find the Intersection point of two Y-shaped LinkedList

Problem Link /* Link list Node struct Node { int data; struct Node* next; }; */ /* Should return data of intersection point of two linked lists head1 and head2. If there is no intersecting point, then return -1. */ int intersectPoint(struct Node* head1, struct Node* head2) { // Your Code Here int cnt1,cnt2,cnt; Node

Merge K sorted LinkedList into one sorted LinkedList

Problem Link /*Linked list node structure struct node { int data; struct node* next; };*/ /*You are required to complete this function*/ node * mergeKList(node *arr[],int N) { //Your code here node *headArray[11]; node *tmpNodes[11]; node *newHead,*tmp,*t; for(int i=0;i<=N;i++) { tmpNodes[i]=arr[i]; } bool f=1; bool first=0; while(f) { int min=10000000; int lastIdx=-1; f=0; for(int i=0;i<=N;i++)

Binary to decimal conversion from a linkedlist binary data stream.

/* Below global variable is declared in code for modulo arithmetic const long long unsigned int MOD = 1000000007; */ /* Link list Node/ struct Node { bool data; // NOTE data is bool struct Node* next; }; */ // Should return decimal equivalent modulo 1000000007 of binary linked list long long unsigned int decimalValue(struct

Some LinkedList Related Problems-2

Reverse A Doubly Linked List. void addNode(struct node **head_ref,int pos,int data) { node *current=*head_ref; while(pos) { current=current->next; pos–; } node *tmp=new node; tmp->data=data; tmp->prev=current; tmp->next=current->next; current->next=tmp; } Prints the nodes having no siblings. /* Tree node structure used in the program struct Node { int data; struct Node* left, *right; }; */ void printSibling(struct Node*

Some LinkedList related problems

Problem Link Sort the linked list according to the actual values: /* The structure of the Linked list Node is as follows: struct Node { Node* next; int data; }; */ void sortList(Node** head) { // Your Code Here Node *tmp=(*head)->next; Node *prevHead; Node *tmp2=new Node; Node *node; bool f=0; while(tmp) { if(tmp->data<0) { if(f==0)