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
Why do we use setw in c++?
How we can differentiate between a pre and post increment operators during overloading?
Why is main an int?
What are all predefined data types in c++?
Do you know about latest advancements in C++ ?
Why do we use string in c++?
What are the syntactic rules to be avoid ambiguity in multiple inheritance?
What do you mean by static variables?
When can I use a forward declaration?
Are vectors passed by reference c++?
Is c++ a good beginners programming language?
Write a Program for dynamically intialize a 2 dimentional array. Eg:5x20, accept strings and check for vowels and display the no.finally free the space allocated .
What is c++ w3school?
What does getch() do according to the ANSI C++ standard a) Reads in a character b) Checks the keyboard buffer c) Nothing in particular (Its not defined there)
What is the difference between #define debug 0 and #undef debug?