yeah..... it totally depends on the no. of data fields :) On Mon, Jul 4, 2011 at 2:03 PM, sunny agrawal <sunny816.i...@gmail.com>wrote:
> @Sagar > if it has a large no of data fields than don't u think just changing > pointers will be much better than swapping all the data contained in the > node > > On Mon, Jul 4, 2011 at 11:13 AM, sagar pareek <sagarpar...@gmail.com>wrote: > >> @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. >> > > > > -- > Sunny Aggrawal > B-Tech IV year,CSI > Indian Institute Of Technology,Roorkee > > > -- > 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.