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

What are the two forms of #include directive?

645


Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc

5056


Explain what does the function toupper() do?

636


Explain which function in c can be used to append a string to another string?

590


how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?

1498






What is linear search?

678


WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.

2030


WRITE A PROGRAM TO MERGE TWO SORTED ARRAY USING MERGE SORT TECHNIQUE..

1599


What is the difference between class and object in c?

583


How can I find out if there are characters available for reading?

647


What do you mean by c?

590


What is sizeof return in c?

617


What are nested functions in c?

567


Is it better to use malloc() or calloc()?

650


What is action and transformation in spark?

598