Memory is not a constraint. In a single iteration(NOTE: you
can't go back), how will you find out the 10th last
node/item in a linked list.

Answer Posted / mms zubeir

I got it, thank you.

but one suggestion, instead of using

printf("Tenth last element is %d",nodes[(pos-10)%10]->data);

you can simply give,
printf("Tenth last element is %d",nodes[pos%10]->data);

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In which header file does one find isalpha() a) conio.h b) stdio.h c) ctype.h

935


What is pure virtual function? Or what is abstract class?

789


Will rust take over c++?

766


What are the methods of exporting a function from a dll?

834


What are its advantages and disadvantages of multiple inheritances (virtual inheritance)?

812






Do you know the problem with overriding functions?

783


What kind of jobs can I get with c++?

798


What is the difference between the compiler and the preprocessor?

827


What is c++ try block?

783


Is std :: string immutable?

750


What is the use of dot in c++?

809


Can you be bale to identify between straight- through and cross- over cable wiring? And in what case do you use straight- through and cross-over?

723


Write my own zero-argument manipulator that should work same as hex?

776


which one is equivalent to multiplying by 2:Left shifting a number by 1 or Left shifting an unsigned int or char by 1?

934


In the derived class, which data member of the base class are visible?

839