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

Have two pointers p1 and p2.p1 points to the first node in the linked list.p2 to the tenth node.Now move both the pointer togther till p2->link = NULL.P1 is pointing to the 10th node from the last

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you define/declare constants in c++?

775


What is the full form nasa?

761


What is the v-ptr?

897


What is one dimensional array in c++?

821


Write a function to find the nth item from the end of a linked list in a single pass.

744


Is c++ a good first language to learn?

758


What is difference between array and vector in c++?

743


A mXn matrix is given and rows and column are sorted as shown below.Write a function that search a desired entered no in the matrix .with minimum complexity 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

3461


Explain the difference between class and struct in c++?

802


What is the use of setprecision in c++?

726


Which is not a valid keyword a) public b) protected c) guarded

996


What is the difference between #import and #include?

769


What is the difference between the functions rand(), random(), srand() and randomize()?

950


Is c++ high level programming language?

885


Are there interfaces in c++?

744