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
I have file with input as below : Name Value Rohan 12,13,14 Rohit 1,2,3 Output should be : Rohan 12 Rohan 13 Rohan 14 Here how will the normalize component work? Thanks
objective type quistion
What is the pressure in co2 cartridge in a DCP 5 kg extinguisher.
postfix expression for x^y^z-m+n+p/q ?
Tell me about urself? asked me qstns on my resume what about higher studies any plans? where do u find urself after 3-4
Please explain me gsm call scenario for a prepaid roamer calling to a prepaid roamer?
If you were to drill a circular hole in a sheet of metal and then heat the sheet, what would happen to the size of the hole?
I an doing Engineering in IT(4th year). i want to know what is the scope or .NET and Linux, and which is better for carrier
I am getting the following error,when I am running the script, Cannot identify the specified item of the regions object. Confirm that the specified item is included in the object's item collection. My Script: Itemname=Browser("MLSListings.com").Page ("MLSListings.com").WebList("regions").GetItem(i+1) Print Itemname Browser("MLSListings.com").Page ("MLSListings.com").WebList("regions").Select "Itemname" Any Help? Thanks, Uma
Please. Does someone know how to inicialize tapes in ATL? I need have 100 tapes to init inside the ATL, how is the process to complete this request?
what are nanoemulsions and how are they prepared? i want a brief outline about nanoemulsions.. is anyone of you is having any literature, can you share that? also any an idea where i can get the information?
can you provide me uniken pvt ltd. technical interview question and answer?
What are your short and long term goals?
How to score well in examination of MCA(engg) december 2012? please reply soon........
how will u test the idoc