code : https://ide.codingblocks.com/s/82877
I am node getting any output but code is compiling successfully. Please tell me what is wrong
LL K reverse no output
@sid.pahuja hey siddharth you reverse function is not right.
try with this function
node* reverseKElements(node*&head, int k){
int x=k;
node * C=head;
node * P=NULL;
node * N=NULL;
int count=0;
while(C!=NULL && count<x ){
N=C->next;
C->next=P;
P=C;
C=N;
x- -;
}
if (N != NULL)
head->next = reverseKElements(N, k);
return P;
}