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 / mayank pathak
Maintain a queue with ten elements. As u encounter a new
element in the linked list dequeue one element and enqueue
this new element. When the link list is fully scanned the
first element of the queue would be the 10th last element.
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain the difference between class and struct in c++?
Why is c++ awesome?
Why ctype h is used in c++?
In a function declaration what does extern means?
Why do we need function?
What is a modifier in c++?
Is map ordered c++?
Why is main function important?
Who discovered c++?
Why should we use null or zero in a program?
Explain about templates of C++.
What do you mean by storage classes?
What is c++ good for?
Why is polymorphism useful?
Write a function to find the nth item from the end of a linked list in a single pass.