![]() Vector :Vectors are sequence containers representing arrays that can change in size.So most of the programmers don't use such cumbersome method. We can create Adjacency list by making out own classes and functions like addEdge(), removeEdge() etc which is not a good practice in competitive programming because we don't have enough time to write a lot of stuff. ![]() Here E = number of edges and V = number of vertices in a graph. Example we can run DFS on adjacency List in O(E + V) time while it requires O(V * V) time for Adjacency Matrix. ![]() We can solve many graph problems much efficiently using Adjacency list representation of a graph as compared to Adjacency Matrix. ![]() This is one of several commonly used representations of graphs for use in computer programs. Each list describes the set of neighbors of a vertex in the graph.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |