@Anantha Krishnan
Well be specific....
just read the question again..... it has only to reorder numbers...
what problem will occur if it has more than one data fields
we can traverse with help of digits and then swap all the data fields

On Thu, Jun 30, 2011 at 5:03 PM, Anantha Krishnan <
ananthakrishnan....@gmail.com> wrote:

> @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 <sagarpar...@gmail.com>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 <ronziiretu...@gmail.com>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 algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> 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 algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to