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 / mms zubeir
I got it, thank you.
but one suggestion, instead of using
printf("Tenth last element is %d",nodes[(pos-10)%10]->data);
you can simply give,
printf("Tenth last element is %d",nodes[pos%10]->data);
| Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
What does namespace mean in c++?
How c functions prevents rework and therefore saves the programers time as wel as length of the code ?
Should you pass exceptions by value or by reference?
Is it possible to get the source code back from binary file?
What is the difference between reference and pointer?
I want to write a C++ language program that: 1. Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. The program should work for squares of all side sizes between 1 and 20.
Explain the difference between static and dynamic binding of functions?
Write is a binary search tree? Write an algo and tell complexity?
What will happen if a pointer is deleted twice?
What is the difference between global variables and local variable
Write about the retrieval of n number of objects during the process of delete[]p?
Write an algorithm that determines whether or not an almost complete binary tree is a heap.
What are special characters c++?
Explain the use of this pointer?
Should I learn c++ c?