Write a nonrecursive routine to reverse a singly linked
list in O(N) time.
Answer Posted / sandeep
node * reverse(node * list)
{
node *p, *q, *r;
p = list;
q = p->next;
while(q->next != NULL)
{
q = p->next;
r = q->next;
p->next = r;
q->next = p;
p = p->next;
}
q->next = p;
p->next = NULL;
return q`;
}
Is This Answer Correct ? | 26 Yes | 7 No |
Post New Answer View All Answers
describe what is const pointer and why do we need it?
HOW WE CAN CORRELATE THE MA\ECHANICAL POWER TO ELECTRICAL POWER. SUPPOSE IF I WANT A PUMP OF PUMPIG 200 LPM AT 20 METER HEAD MENAS WHAT IS THE POWER NEEDED FOR PUMP IN ELECTRCAL AND HOW CAN WE GET IT
what is locative information on web.........?
W.A.P to take input of an array and display the entered no. in dos.
What is Mointer in Operating System?
different types of protocols.......?
how you judge that your interview go good????
why we select you?
Please send me the ongc old question papers
what is the difference between VARCHAR and VARCHAR2?
WHAT IS THE NAMESPACE FOR CUSTOMCONTROL AND USER CONTROL IN ASP.NET?
Suppose that, even unrealistically, we are to search a list of 700 million items using Binary Search, Recursion (the algorithm given in class). What is the maximum number of comparisons that this algorithm must perform before finding a given item or concluding that it is not in the list?
How does agile communication differ from tradition software engineering communication? How it is similar?
What is ball bearing concept & its design.
what is the difference between composite key and primary key in sap abap