Question: Add to Graph the implementations of (mathrm{V}()) and (mathrm{E}()) that return the number of vertices and edges in the graph, respectively. Make sure that your
Add to Graph the implementations of \(\mathrm{V}()\) and \(\mathrm{E}()\) that return the number of vertices and edges in the graph, respectively. Make sure that your implementations take constant time. Hint: For V(), you may assume that the size() method in ST takes constant time; for \(\mathrm{E}()\), maintain an instance variable that holds the current number of edges in the graph.
Step by Step Solution
3.38 Rating (151 Votes )
There are 3 Steps involved in it
It seems like you are asking how to implement two methods V and E for a graph data structure The V method should return the number of vertices in the ... View full answer
Get step-by-step solutions from verified subject matter experts
