Search:

Type: Posts; User: ueg1990

Search: Search took 0.15 seconds.

  1. Replies
    11
    Views
    2,220

    Re: Lowest Common Ancestor in Binary Tree

    ok, i have one question abt bottom-up traversal, do it go uptill leaves and then up to the nodes i am calculating LCA for? and from there i go to the root?
  2. Replies
    11
    Views
    2,220

    Re: Lowest Common Ancestor in Binary Tree

    ok, so my findOrQueue function does that....it finds the node first and then as it does find it, it adds the others nodes in its path to a queue....which part r u referring to with respect to...
  3. Replies
    11
    Views
    2,220

    Re: Lowest Common Ancestor in Binary Tree

    can u plz give an example of how to do bottom up traversal?? i dont understand how to build traversal bottom-up without knowing where the node is??
  4. Replies
    11
    Views
    2,220

    Re: Lowest Common Ancestor in Binary Tree

    so lets stay i have a parent pointer, i still have to traverse to the two nodes whose LCA i am calculating...so how will bottom-up help me?? can u plz help me with this?

    --- Update ---

    or are...
  5. Replies
    11
    Views
    2,220

    Re: Lowest Common Ancestor in Binary Tree

    doesnt bottom-up mean, i will need a parent pointer??
  6. Replies
    11
    Views
    2,220

    Lowest Common Ancestor in Binary Tree

    Following is my implementation of lowest common ancestor for a Binary Search tree. I have two question:

    1) The time complexity is O(n) and space complexity is O(n) worse case but O(logn) average...
Results 1 to 6 of 6