Given a singly linked list find the n-th node from the back.
Click for Solution

  • Warning: Illegal string offset 'name' in /home/prepdo6/gpl4you/discussquessub.php on line 681
    A let "list ' points to the 1st node

    void Show_nthElementFromLast(node *list ,int n)
    {
    node *pt;
    int i,c=0;
    if(list==NULL)
    printf("empty");
    else
    {
    for(pt=list;pt!=NULL;pt=pt->next)
    c++;
    for(pt=list,i=0;i<c-n;i++,pt=pt->next);
    printf("%d",pt->info);
    }
    }


  • Warning: Illegal string offset 'name' in /home/prepdo6/gpl4you/discussquessub.php on line 664

  • Warning: Illegal string offset 'name' in /home/prepdo6/gpl4you/discussquessub.php on line 682
    k kjkklkjlklkj

[Insert Code]