iouyiugjl

On Fri, Sep 10, 2010 at 5:00 PM,
<algogeeks+nore...@googlegroups.com<algogeeks%2bnore...@googlegroups.com>
> wrote:

>   Today's Topic Summary
>
> Group: http://groups.google.com/group/algogeeks/topics
>
>    - Explain <#12afb697e122ca05_group_thread_0> [8 Updates]
>    - I want improve my algorithm?? <#12afb697e122ca05_group_thread_1> [2
>    Updates]
>    - how we can access 2nd element of an 
> struct<#12afb697e122ca05_group_thread_2>[3 Updates]
>    - Graphs... <#12afb697e122ca05_group_thread_3> [1 Update]
>    - Recursion!!!!!!!!!!! Always Stuck <#12afb697e122ca05_group_thread_4>[2 
> Updates]
>
>   Topic: Explain<http://groups.google.com/group/algogeeks/t/11fdf6ccb127e26e>
>
>    saurabh agrawal <saurabh...@gmail.com> Sep 09 07:22PM +0530 
> ^<#12afb697e122ca05_digest_top>
>
>    Can somebody explain how the macros are expanded regarding order in
>    which
>    they are used...etc...
>
>    also explain this example :
>
>    #define A B
>    #define B A
>
>    what is the effect of this and whether it will go in an infinite
>    recursive
>    call or not and why?
>
>
>
>
>    umesh kewat <umesh1...@gmail.com> Sep 09 10:33PM +0530 
> ^<#12afb697e122ca05_digest_top>
>
>    Hi saurabh,
>
>    it will not going to infinite...
>
>    1st all A will be replaced by B so later #define B B be remaining so
>    this statement is valid.. program will going to execute fine..
>
>
>    --
>    Thanks & Regards
>
>    Umesh kewat
>
>
>
>
>    saurabh agrawal <saurabh...@gmail.com> Sep 10 09:59AM +0530 
> ^<#12afb697e122ca05_digest_top>
>
>    @umesh kewat
>
>    #include<stdio.h>
>    int main(){
>    int A =4;
>    #define A B
>    #define B A
>    printf("%d",A);
>    return 0;
>    }
>
>    This code works fine...but as you have explained the later A used in
>    printf
>    statement must have replaced by B. In that case there must be a
>    compiler
>    error "The identifier not defined". But this code compiless fine. and
>    there
>    seems no visible effect of these two macros.
>
>
>
>
>    Ayush Mittal <ayushmittal2...@gmail.com> Sep 10 02:39PM +0530 
> ^<#12afb697e122ca05_digest_top>
>
>    this code is working fine,whether u have defined B or not and if you
>    replace
>    A with B in two macros it is still running well giving output 4 in each
>    case
>
>
>
>
>
>    praveen <praveen200...@gmail.com> Sep 10 02:58AM -0700 
> ^<#12afb697e122ca05_digest_top>
>
>    After preprocessing
>
>    Where ever there is 'A' in your program, it is replaced by 'B'
>    Where ever there is 'B' in your program, it is replaced by 'B'
>
>    this will be the program look like
>    #include<stdio.h>
>    int main(){
>    int B =4;
>
>    printf("%d",B);
>    return 0;
>
>    }
>    therefore, the program will compile and run :)
>
>
>
>
>    umesh kewat <umesh1...@gmail.com> Sep 10 02:35PM +0530 
> ^<#12afb697e122ca05_digest_top>
>
>    HI Saurabh,
>
>    #include<stdio.h>
>    int main()
>    {
>    int A =4;
>
>    #define A B
>    #define B A*3
>    printf("%d",A);
>    return 0;
>    }
>
>    Above example will explain ur doubt...
>
>
>    --
>    Thanks & Regards
>
>    Umesh kewat
>
>
>
>
>    umesh kewat <umesh1...@gmail.com> Sep 10 03:51PM +0530 
> ^<#12afb697e122ca05_digest_top>
>
>    HI,
>
>    Here are some fact related to macros..
>
>    its a preprocessor directory so before comping the code will replaced
>    by
>    appropriate macros... these are not comping or executing ..so macros
>    replaced one by one and other fact macro will not replaced the content
>    of
>    other macros...
>
>    so code of 1st code will be like that after preprocessing
>
>    1st all A will be replaced by B except #define B A,
>    2nd replaced in code where ever is B is replaced by A so like..
>
>    sorry for my 1st post giving wrong explanation...
>
>
>    @saurabh in ur 2nd post
>
>    after preprocessing of 1st macro code be like that
>
>    include<stdio.h>
>    int main(){
>    int A =4;
>    #define B A
>
>    printf("%d",B);
>    return 0;
>
>    }
>
>    after 2nd preprocessing
>
>    include<stdio.h>
>    int main(){
>    int A =4;
>
>    printf("%d",A);
>    return 0;
>
>    }
>    so out put is 4
>
>    if need more explanation of above logic you can see by running those
>    example
>
>    #include<stdio.h>
>    int main()
>    {
>    int A =4;
>
>    #define A B
>    #define B A*3
>    printf("%d",A);
>    return 0;
>    }
>
>    #include<stdio.h>
>    int main()
>    {
>    int A =4;
>
>    #define A B*B
>    #define B A
>    printf("%d",A);
>    return 0;
>    }
>
>
>    the 1st statement will not affect by preprocessor becoz those macros
>    definition are coming after that otherwise u can see
>
>    #include<stdio.h>
>    int main()
>    {
>    int A =4;
>
>    printf("%d",B)
>    #define A B
>
>    return 0;
>    }
>
>
>
>    for some more
>
>    #include<stdio.h>
>    int main()
>    {
>    int A =4;
>
>    printf("%d",A);
>
>    printf("%d",B);
>
>    #define A B
>
>    printf("%d",B);
>    #define B A
>
>    printf("%d",B);
>    printf("%d",A);
>
>    return 0;
>    }
>
>    by looking compilation error u will able to see the scope of macros
>    and their preprocessing ..
>
>
>
>    thanks for reading long post.. :)
>
>
>
>    --
>    Thanks & Regards
>
>    Umesh kewat
>
>
>
>
>    saurabh agrawal <saurabh...@gmail.com> Sep 10 04:25PM +0530 
> ^<#12afb697e122ca05_digest_top>
>
>    Thanks a lot umesh...but still i am in confusion that:
>
>    after first processing : "A is replaced by B"
>    after second proecessing " B is replaced by A"
>    then why again this A is not being replaced by #define A macro..
>    why it is not going in an infinite loop...because i think there is no
>    fiexed
>    order of execution of the macro..
>    even if you change the order in which macros are defined will make no
>    effect...
>
>
>
>   Topic: I want improve my 
> algorithm??<http://groups.google.com/group/algogeeks/t/92f857877507c4f8>
>
>    ashwin <ashwin4e...@gmail.com> Sep 09 05:22AM -0700 
> ^<#12afb697e122ca05_digest_top>
>
>    hi i am too the same.. The only way to improve is to practice solving
>    more and more problems. Try solving simple programming problems and
>    progress from there.. Good Luck
>
>
>
>
>
>    soundar <soundha...@gmail.com> Sep 09 11:59PM -0700 
> ^<#12afb697e122ca05_digest_top>
>
>    www.spoj.pl
>    www.topcoder.com/tc
>    www.codechef.com
>
>
>    Solve problems from these sites......
>
>
>
>   Topic: how we can access 2nd element of an 
> struct<http://groups.google.com/group/algogeeks/t/339a1f7d69ad15ce>
>
>    soundar <soundha...@gmail.com> Sep 09 10:46AM -0700 
> ^<#12afb697e122ca05_digest_top>
>
>    It is giving me error........."invalid cast from type ‘main()::node’
>    to type ‘char*"
>
>
>
>
>    soundar <soundha...@gmail.com> Sep 09 10:47AM -0700 
> ^<#12afb697e122ca05_digest_top>
>
>    can you explain?thanks in advance
>
>
>
>
>    Sathaiah Dontula <don.sat...@gmail.com> Sep 09 01:20PM +0530 
> ^<#12afb697e122ca05_digest_top>
>
>    I think the question should have been quite generic, if it is integer
>    you
>    can go from the void pointer to four bytes ( sizeof(int)) ahead and get
>    the
>    next number that is what is required for us. But what if we do not know
>    what
>    is the member type is ?, How we can get the second member if the first
>    member type of the structure is not know.
>
>    a=(float *)((char *)a+sizeof(node)-sizeof(int)); ==> Just modified to
>    subramani.
>
>    Thanks,
>    Sathaiah Dontula
>
>
>
>
>   Topic: 
> Graphs...<http://groups.google.com/group/algogeeks/t/7df7b32307edc9d3>
>
>    Gene <gene.ress...@gmail.com> Sep 09 01:33PM -0700 
> ^<#12afb697e122ca05_digest_top>
>
>    A DAG naturally has sources - vertices with only out-going edges - and
>    sinks - vertices with only incoming edges. All edges with a maximal
>    number of edges run from a source to a sink (why?). You can find them
>    most easily with a breadth-first search starting simultanously from
>    all the sources.
>
>
>
>
>   Topic: Recursion!!!!!!!!!!! Always 
> Stuck<http://groups.google.com/group/algogeeks/t/8000787e16954967>
>
>    bittu <shashank7andr...@gmail.com> Sep 09 12:02PM -0700 
> ^<#12afb697e122ca05_digest_top>
>
>    Can Anyone explain me how recursion works in C.
>    i will be thankfull if he/she will use an example of
>    towerofhanoi .???????????????
>
>    Regards
>    Shashank
>
>
>
>
>    albert theboss <alberttheb...@gmail.com> Sep 10 01:11AM +0530 
> ^<#12afb697e122ca05_digest_top>
>
>    Its easy only ....
>
>    tower of hanoi consist of three pegs peg A,peg B,peg C.
>    which is used as BEG,AUX,END
>
>    Let n be 5 for example...
>
>    wat u r going to do is
>
>    step 1 : move the top n-1 (4) disks from BEG to AUX...
>    in this case END will be used as auxiliary.
>
>    step 2: move the n th disk from BEG to END .
>    use AUX as auxiliary in this case
>
>    step 3: move the n-1(4) disks from AUX to END that is moved in step 1
>    use BEG as auxiliary in this step
>
>
>    Actual code is
>
>    void tower(int n,char beg,char aux,char end)
>    {
>    if(n>0)
>    {
>    tower(n-1,beg,end,aux); // move n-1 disks from beg to
>    aux
>    printf("%c->%c",beg,aux,end);//equivalent to
>    tower(1,beg,aux,end) move 1 disk from beg to end
>    tower(n-1,aux,beg,end) // move disks from aux to end
>    }
>    }
>
>    again that n-1 disks are moved to end which is called recursively.....
>
>    Still u have doubt???
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@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 algoge...@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