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
What is the use of data hiding?
What is prototype in c++ with example?
What is an adaptor class in c++?
What is the use of turbo c++?
Is c++ an oop?
What are the uses of typedef in a program?
Can the operator == be overloaded for comparing two arrays consisting of characters by using string comparison?
How would you call C functions from C++ and vice versa?
Should I learn c or c++ first?
You run a shell on unix system. How would you tell which shell are you running?
Can there be at least some solution to determine the number of arguments passed to a variable argument list function?
I was a c++ code and was asked to find out the bug in that. The bug was that he declared an object locally in a function and tried to return the pointer to that object. Since the object is local to the function, it no more exists after returning from the function. The pointer, therefore, is invalid outside.
What is class syntax c++?
Write a note about the virtual member function?
What is math h in c++?