i would prepare the transitivity matrix while inserting the edge into the
matrix

the search then would be a O(1)


Best Regards
Ashish Goel
"Think positive and find fuel in failure"
+919985813081
+919966006652


On Sun, Jul 4, 2010 at 3:15 PM, jalaj jaiswal <[email protected]>wrote:

> A graph is given. You need to design a data structure with minimum space
> complexity such that it does the follows
> --> Finds whether nodes u and v have a path in between them in O(1) time.
> --> Finds whether there is a path of length k between u and v in O(k) time.
> The same data structure to be used for both the purposes.
>
>
>
>
> --
> With Regards,
> Jalaj Jaiswal
> +919026283397
> B.TECH IT
> IIIT 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]<algogeeks%[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.

Reply via email to