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
is the used fire extinguisher fall under Hazardous waste material?
Explain the following program segment. f(){ int *b; *b=2; }
why one should join accenture?
WHAT HAPPEN WHEN ANY SPINDLE RUN OVER 10 MM HEIGHT ABOVE BOLSTAR IN RING SPINNING FRAME
plz send me interview questions & answers of Data Structure
A rectangular sheet dimensions a x b is to be made into an open-topped box by cutting a square of side h from each corner and folding the 4 sides up. Find the value of h which allows the maximum volume of the box?
What is necking in production engineering ?
What is the difference between CD-R and CD+R?
Sir, I was recently placed at ITC Infotect. My ctc is 2.46lpa. How much will I get in hand every month? Plssss answer. Thanx in advance.
describe about storage allocation and scope of global,exterm,static,local and register variables in c language?
C++ PROGRAM FOR FIBONACCI SERIES USING COPY CONSTRUCTER
write a c program which accept input as:Anu.B.Kapur and give out as:Kapur.A.B using pointers
Q1 Design a webpage for a hotel which displays all the information of the hotel such as rooms available, facilities, and packages along with rate list. Apply the different tags available to give it a good style.
can i learn ad. java without learned core java? java is best or .net is best for summer training?
Is Diesel staorage tank ( 800 litres) cleaning procedure is available with any body