Add to Graph the implementations of (mathrm{V}()) and (mathrm{E}()) that return the number of vertices and edges

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 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.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: