|
Hi Nitin Reply embedded. Thanks!! and have
a nice day!! Jaspreet -----Original Message----- Hi everybody, Here's my query please revert if anybody could help me
out. 1. How do i reverse a n single linked list in one
iteration? (i.e.) the linked list data contents should not be
altered only temperoray variables and pointers can be assigned Jaspreet-
> Well Nitin, of late my hobby has been to give atleast 1 technical interview per week. This has become a
standard question these days. I wish the companies
could ask something different and innovative. Okkie,
here’s the solution: (Apologies for no comments) p = head; q = p->next; p->next = NULL; while (q != NULL) { r
= q->next; q->next
= p; p
= q; q
= r; } Now
what I would like u to try is to reverse a doubly linked list. Something different… 2. how do i take out the
looping problem in a large linked list? (All linked list are single linked list and can have
an structure say struct node n{ int data; struct node *p; } so on) Jaspreet
-> I gave a solution but I guess it was not liked by the group members. Lets
c… Have
2 pointers to start of the linked list. Increment one pointer by 1 node and the
other by 2 nodes. If there’s a loop the 2nd pointer will meet
the 1st pointer somewhere. If it does, then you know there’s one. Lets c if some1 has a
more efficient solution. Thanks and Regards Nithin
Do you Yahoo!? Note:
This message is for the named person's use
only. It may contain confidential, proprietary or legally privileged
information. No confidentiality or privilege is waived or lost by any
mistransmission. If you receive this message in error, please
immediately delete it and all copies of it from your system, destroy any hard
copies of it and notify the sender. You must not, directly or indirectly,
use, disclose, distribute, print, or copy any part of this message if you are
not the intended recipient. MINDTECK (INDIA)
LTD and any of its subsidiaries each reserve the right to
monitor all e-mail communications through its networks.
Any views expressed in this message are those of
the individual sender, except where the message states otherwise and the sender
is authorized to state them to be the views of any such entity.
Thank You.
To unsubscribe : [EMAIL PROTECTED]
Yahoo! Groups Links
|
- (PT) query Jaspreet Oberoi
- (PT) query shiffy jose
- Re: (PT) query Kapil
- Re: (PT) query deo sharma
- RE: (PT) query Paul Herring
