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 / dark knight
1-TAKE TWO POINTERS
2-ITERATE 1 POINTER IN THE LIST UP TO THE 10th POSITION FROM STARTING
3-INITIALLY----2nd POINTER IS AT THE HEAD NODE .
4-NOW INCREEMENT both POINTER TO THE NEXT POTISION SUCH THAT THE
1st pointer reaches end .
5--2ND POINTER IS THE REQUIRED NODE
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How can we read/write Structures from/to data files?
Should I learn c or c++ first?
What are maps in c++?
Is c++ used anymore?
Write a program to find the Factorial of a number
How do you find out if a linked-list has an end? (I.e. The list is not a cycle)
Is it possible to pass an object of the same class in place of object reference to the copy constructor?
Is c++ the hardest language?
What is an incomplete type in c++?
What is general form of pure virtual function? Explain?
give me an example for testing a program showing the test path .show how the test is important and complex.
What is difference between array and vector in c++?
What is flush () in c++?
How can we check whether the contents of two structure variables are same or not?
how to access grid view row?