In CLRS excise 22.1-8 (I am self learning, not in any universities)
Suppose that instead of a linked list, each array entry Adj[u] is a hash table conta
The answer to question 3 could be a binary search tree.
In an adjacency matrix, each vertex is followed by an array of V elements. This O(V)-space cost leads to fast (O(1)-time) searching of edges.
In an adjacency list, each vertex is followed by a list, which contains only the n adjacent vertices. This space-efficient way leads to slow searching (O(n)).
A hash table is a compromise between the array and the list. It uses less space than V, but requires the handle of collisions in searching.
A binary search tree is another compromise -- the space cost is minimum as that of lists, and the average time cost in searching is O(lg n).