@sagar pareek
If there are more fields in the node like:
struct node{
int data;
float mark;
char ch;
struct node *link;
};
Here swapping *data* alone will corrupt the list right!!
On Thu, Jun 30, 2011 at 4:38 PM, sagar pareek <[email protected]> wrote:
> Here is one approach which works :)
>
> Traverse the list from a pointer name ptr
> when encounter odd then start traversing from a tmp pointer (start point is
> ptr->next) to find even no. when find it swap the numbers.
> then again start forwarding ptr. If during traversing ptr==tmp make
> flag=0(at start make it flag=1) if again ptr encounter odd then if flag=0
> then tmp=ptr->next else tmp=tmp->next
> do it until tmp or ptr becomes null. :)
> I hope no questions :) :)
>
>
> On Thu, Jun 30, 2011 at 12:01 PM, Rohan Kalra <[email protected]>wrote:
>
>> http://geeksforgeeks.org/?p=12000
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/algogeeks/-/OnLux79bj3MJ.
>>
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> **Regards
> SAGAR PAREEK
> COMPUTER SCIENCE AND ENGINEERING
> NIT ALLAHABAD
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.