Kreverse-Linked Lists

this is regarding the first problem kreverse in linked list


please check and let me know why am I getting the error.
Thanks.

Hello @rachitbansal2500,

  1. You are not incrementing the variable:
    while(i < size){
    insertt(head,data);
    cin>>data;
    //correction:
    i++;
    }

  2. Correct the logic of k reverse.

  3. Also, correct the output format. It is different from that required by the question.

Note:
K>=N. Keep this point in mind.

Hope, this would help.
Give alike if you are satisfied.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

Hi! I can’t really understand the problem right now as well. I did update i++ I am still getting a segmentation error how to fix that?

Hello @rachitbansal2500,

Let’s understand the logic with the help of following code segment:

Let me know if you face any issue.

1 Like