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 many VLANs are supported on a single switch
can i knw what are we supposed to read for the coming oces/dgfs 2009 exam?what kind of book are we supposed to study?
Sketch a velocity time graph for a skydiver jumping out of a plane.
what are basic step involved in embedded system software development?
sir i have 4 year gap in engineering. i would complete my degree b.tech it in 2014. it will be may be in 2nd class.my hsc is also with 2nd class. i am week in programming. Then if i want highest package upto 5-6 lacs then what should i prepare myself as a good engineer to get this package???
Is there aptitute question will be asked in NIC exam ??? If yes how many questions will be asked??
can anybody send me the technical papers of hewitt associates pls...I cleared aps n GD n has only less time for technical round?
what is the need of constractor explain with sutable progarmming example
pls send me rrb se(s&t)questions
i want questions only on code part like general logics in c and java
Please if anybody have Vizag Steel Entrance exam papers or atleast Pattern of exam.Then please forward to my email- id: :srikanth.avanthi@gmail.com
project plan for bug tracking system?
376,188,88,40,16,4,-2. Find wrong term in series
Briefly describe your ideal job?
how to initialize a pointer to an array?