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'm currently placed in Lahore Pakistan. where can i do Microsoft certification. let me know the best place to do.?
Write a test case plan for a typical banking application which involves functionalities like Balance enquiry, deposit, fund transfer etc. Make your assumptions and mention the same in your answer sheet.
hi to all,i done ccna,now im looking job,but it is very diffcult to get job in networking field,.........i dnt know what im doing wrongly,kindly help me and give the proper way...i have so much of interest in this field only
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
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?
need tcs questn papers from 2007 to 2009 plzzzmail to 9015.rama@gmail.com its urgent
please answer the following question: A table contains the monthly sales data for the 12 months of a year and for the 4 sales zones where each zone has 8 districts.The table is defined in WORKING-STORAGE SECTION.What is the size of the defined table in number of bytes? write statements to calculate the total sales for each month.
What is RAC?(Real Application Cluster).Explain in Detail.
explain about scope and storage class in oops
please send me latest Aptitude Test paper
is the used fire extinguisher fall under Hazardous waste material?
Please tell us about an implementation that you worked on that did not go as planned. What were the challenges you faced and how did you overcome them
sir,i am a 3rd yr student of computer engineering. i need atleast 10 previous year's placement papers of hcl,infosys & wipro. please send me these papers as early as possible.thanx for giving me your precious time.
Explain the memory reference and register reference instructions as micor operation.
write a pgm to accept an array of names & name & check whether the name is present in the array. return the count of occurance. use following array as input; {"Dave","Ann","dev","merry"}