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
how to connect oracle with java ? Give detail explanation.
NIC question paper
how am i supposed to convert a class program in C++ to Matlab? Do i also need to make classes in matlab too or I can do it without making classes???Can somebody help....
why we need embedded system
how bluetooth works?what is principle behind in it?
what is buffer solution?
Write a program in āCā language that will perform the following operation on static stack. 1. push 2. pop 3. Display 4. Exit Create separate functions for each operation. The push() should accept one argument of structure type and will not return any thing. The pop() function will not receive any argument & return structure type value. The stack & top must be declare as external variable. Each element of stack will contain the following information Roll No, Std Name, Course. Use do-while loop & switch case for generating the above menu. The format of the output should is given below: S.No. Roll No. Student Name Course 1 cse01 Anil Singh B.Tech
explain overloaded constrator © constractor
tell me the e book for data structure (basic)
what is difference between server 2008R1 and 2008 server R2?
Please state briefly the reasons why you think you are an outstanding candidate for this job
in b+ trees, all the data is stored in leaf nodes. if all leaf nodes are crashed then how to get/recovery the data back?
who is your role modal give in few sentances
What is Moore's law and what limits the size of a computer chip?
when load increase in generator in island mode, why turbine rpm is reduced