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

What are enumerations?

669


Write about the scope resolution operator?

620


write asingle linked list which read from two list & the do the following 1 sort the prime & nonprime num (prime should be less tn nonprime) 2 each node has a prime num followd by nonprime 3 add a new node into its sutable plce 4 erase the most three duplicated non prime num 5 find the least duplicated prime num

2205


What function initalizes variables in a class: a) Destructor b) Constitutor c) Constructor

683


What is a hashmap c++?

576






List different attributes in C++?

647


What methods can be overridden in java?

679


What is the use of volatile variable?

609


What would happen on forgetting [], while deallocating an array through new?

641


What is meant by entry controlled loop?

662


What is abstraction in c++ with example?

571


In which situation the program terminates before reaching the breakpoint set by the user at the beginning of the mainq method?

597


Do the names of parameters have to agree in the prototype, definition, and call to the function?

607


Is c++ low level?

584


What is the difference between the functions memmove() and memcpy()?

642