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 / atul bodke
suppose list is already created having some elements
poninted by start ......
node* start;
node*p[10];
node* ptr;
int n=0;
ptr=start;
while(ptr->next==null)
{
p[(n++)%10]=ptr;
}
if(n<10) printf("there r unsufficient elements");
else { ptr=p[n%10]}
| Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
What are exceptions c++?
What does ios :: app do in c++?
What is exception handling? Does c++ support exception handling?
What is the most common mistake on c++ and oo projects?
Is c++ built on c?
What is meant by const_cast?
What is copy constructor? Can we make copy constructor private in c++?
What is null c++?
Define a constructor - what it is and how it might be called (2 methods)?
Write is a binary search tree? Write an algo and tell complexity?
What is a string example?
What is enum c++?
Write a program using GUI concept for the scheduling algorithms in Operating system like SJF,FCFS etc..
What is the use of "new" operator?
Explain some examples of operator overloading?