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 / aaptuster

Cant we simply check it using 10 dereferencing.

ptr -> ptr -> ptr -> ptr -> ->ptr and so on...

This could be generalized for n, as we could generate this
command string on the fly and execute the command ..

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does ctime() do?

618


What is setw manipulator in c++?

600


List the features of oops in c++?

578


Write a function to perform the substraction of two numbers. Eg: char N1="123", N2="478", N3=-355(N1-N2).

623


What is a type library?

686






Can you declare an array without a size in c++?

576


Why do we use vector in c++?

602


Write a struct time where integer m, h, s are its members?

524


Explain linear search.

634


What is the fastest c++ compiler?

589


What are multiple inheritances (virtual inheritance)?

585


What is operator overloading in c++ example?

658


Can non-public members of another instance of the class be retrieved by the method of the same class?

610


Can we define a constructor as virtual in c++?

605


What is lambda expression c++?

580