Implement a function that returns the 5th element from the
end in a singly linked list of integers in one pass.

Answer Posted / vignesh1988i

let us assume that we have created a linked lists ..... the
no. of nodes is say 15.
count=15;
printf("enter the node do you wann to look out :\n");
scanf("%d",&i);
if(i>count || i>=0)
printf("no node exists like this \n");
else
{
i=count-i;
view_node(i);
printf("%d",HEAD1->data);
}
getch();
}
void view_node(int i)
{
HEAD1=HEAD;
for(int k=1;k<i;k++)
HEAD1=->HEAD1->ptr;
}

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.

4781


What is actual argument?

780


‎How to define structures? · ‎

820


Explain bitwise shift operators?

877


What is sizeof in c?

746






Explain what will the preprocessor do for a program?

778


What is the scope of local variable in c?

755


How can a program be made to print the line number where an error occurs?

844


i got 75% in all semester am i eligible for your company

1931


What is a list in c?

775


Explain how can I avoid the abort, retry, fail messages?

788


What is bubble sort technique in c?

743


Tell me when is a void pointer used?

835


Write a program to check armstrong number in c?

844


What do you mean by dynamic memory allocation in c?

821