Write a nonrecursive routine to reverse a singly linked
list in O(N) time.
Answer Posted / hasan ali mirza
list reverse(list L)
{
stack S;
position Lpos = first(L);
while(Lpos->element != NULL)
{
push(Lpos->element, S);
Lpos = Lpos->next;
}
makeEmpty(L);
Lpos = first(L);
while(isempty(S) == FALSE)
{
insert(pop(S), Lpos);
Lpos = Lpos->next;
}
return L;
}
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
why we select you?
what is disadvantages of waterfall model ?? industry used which model ??
Why it is a preferable option in parallelextender development ?
searching a B-tree indexed tree compared to B+ tree is slow..True or false
How will a tester be sure that He’s covered the entire functionality in his Test case and not missed out anything?
Please derive the formula for the area of a circle.
WHAT IS DIFFERENT BETWEEN YOU AND OTHER APPLICANT TO GIVE YOU THE JOB
Can main() function can be made virtual?
WHY WE USE {} AT THE STARTING OF C PROGRAM
T is a tree and V is a vertex of T of maximum degree in T, say the degree of V in n. Prove that T has atleast n vertices of degree 1.
successful command to make linux system as router in redhat-+
i m a student of 4th year ,i m unable to get the embassy appointment dates , and it details.............please help any body.My id=john_searching143@yahoo.com
Just a one miniute topics in English?
Which software model is best suited for the Maintenance kind of project?
how can i write a program in c of SPARCE MATRIX(data structure)?