Question: You are given a graph G . ( Think , G is huge. ) You are asked to build a suitable data structure from G
You are given a graph GThink G is huge. You are asked to build a suitable data structure from G that can help you efficiently answer the following queries ondemand:
input: a node v output all the nodes reachable from v
Describe your data structure and how you will build it from GThough there is no hard limit on the time to build your data structure as a function of Gs size, relatively inefficient solutions will get points deducted. How long does it take to build your data structure in terms of Gs size? Explain. Explain how your data structure is used to efficiently respond to a query and how long this takes.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
