retagged by
721 views
1 votes
1 votes
Describe two different data structures to represent a graph. For each such representation, specify a simple property about the graph that can be more efficiently checked in that representation than in the other representation. Indicate the worst case time required for verifying both of your properties in either representation.
retagged by

1 Answer

0 votes
0 votes
Graphs can be represented in two ways :-

1. Adjacency Matrix.

2. Adjacency List.

Edge existential property can be checked in $\Theta(1)$ time using Adjacency Matrix representation , but using adjacency list it has a worst case complexity of $O(deg(v))$ , deg(v) in worst case is n-1 , thus in worst case using adjacency list would take $O(n)$.

Counting total number of edges can be done using adjacency list in a more effective manner with TC of $O(V)$ , but with Adjacency Matrix it would take $O(v^{2})$

Related questions

2 votes
2 votes
2 answers
2
sripo asked Feb 15, 2019
519 views
T (n) = T (n/2) + 2; T (1) = 1When n is a power of 2, the correct expression for T (n) is:(A) 2(log n + 1)(B) 2 log n(C) log n + 1(D)2 log n + 1
1 votes
1 votes
1 answer
3
sripo asked Feb 15, 2019
536 views
Let a and b be positive integers such that a b and a^ 2 − b^ 2 is a prime number.Then a^2 − b^ 2 is equal to(A) a − b(B) a + b(C) a × b(D) none of the above
3 votes
3 votes
1 answer
4
sripo asked Feb 15, 2019
818 views
When is the following statement true? (A ∪ B) ∩ C = A ∩ C(A) If Ā ∩ B ∩ C = φ(B) If A ∩ B ∩ C = φ(C) always(D) never