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
what is major differnet between hub and switch and also defferent between router and switch
Please state briefly the reasons why you think you are an outstanding candidate for this job
Hi, I am preparing for Assistant Motor Vehicle Inspector (AMVI) exam.If any body having old question papers please send.My mail id is siyadndd@gmail.com
Difference between software process model and software process.?
searching a B-tree indexed tree compared to B+ tree is slow..True or false
Please help to write testcase for ECG machine
i can access command prompt in my pc. when i type cmd in run,message comes-you are restricted.contact admin. why is it so? how can acces it by just logging in as a user and not as admin.?????
What is Lease Line?Why power cord is not required to NT Boxex on which lease is connected ?Why we use use NT BOXEs for ISDN and Lease line?
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?
There are n points and each point enclose with x and y axis form a rectangle and find the point using a program which forms the smallest rectangle?
when does the official confirmation or the offer letter for the 2012 selected candidates of HUAWEI will come??
why view is created in database
Hello everybody, I have applied for the AAI jr executive ATC exam. I am from CSE branch. Is Exam paper for the CSE and other branches same or not? Because I don't have knowlwdge on Electronic subject? Can any one please send me the previous exam papers for AAI Jr Executive of CSE branch My id is: naveen.kocherla@gmail.com Thanks and Regards Naveen
how will u recieve idoc
which is the better form java or .net?exactly when we have to choose particcular 1 among them?