This topic contains 0 replies, has 0 voices, and was last updated by  EduGorilla 1 year, 11 months ago.

  • Author
    Posts
  • #1440102 Reply
     EduGorilla 
    Keymaster
    Select Question Language :


    Consider the following C code which is implemented on a linked list :
    Struct node *Insert_x_and_y(Struct node *S , int X , int Y)
    {
    Struct node *P , *Q , *S1;
    P = (Struct node*)malloc(sizeof(Struct node));
    P->data = x;
    P->next = NULL;
    If(S==null)
    return (NULL);
    if(S->data==y)
    {
    P->next = S;
    S = P;
    return (S);
    }
    else
    {
    S1=S;
    while(S1->data!=y && S1->next!=NULL)
    {
    Q=S1;
    S1=S1->next;
    }
    if(S1->data==y)
    {
    Q->next = P;
    P->next = S;
    }
    else
    Printf(“No y found”)
    return (S);
    }
    }
    What does the following code does ?

    Options :-

    1. Insert node x and y into linked list
    2. Insert node x after y into linked list.
    3. Insert node x before y into linked list.
    4. Insert node y after x into linked list.
    Post your Training /Course Enquiry
    Are You looking institutes / coaching center for
    • IIT-JEE, NEET, CAT
    • Bank PO, SSC, Railways
    • Study Abroad
    Select your Training / Study category
Reply To: Consider the following C code which is implemented on a linked list : Struct node *Insert_x_and_y(S….
Your information:




Verify Yourself




Log in with your credentials

or    

Forgot your details?

Create Account