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

Is c++ the hardest programming language?

630


What is a list c++?

564


Can you please explain the difference between using macro and inline functions?

515


What is null pointer and void pointer and what is their use?

573


What causes a runtime error c++?

568






Can you explicitly call a destructor on a local variable?

592


How the virtual functions maintain the call up?

595


Write about the members that a derived class can add?

558


Why isn't sizeof for a struct equal to the sum of sizeof of each member?

527


When are exception objects created?

596


What is a rooted hierarchy?

671


the first character in the variable name must be an a) special symbol b) number c) alphabet

592


Explain the uses of static class data?

588


What is the best free c++ compiler for windows?

581


What is a breakpoint?

549