Data Structure Interview Questions

What are the applications of Graph data structure?

Post Views: 48,258 The graph has the following applications: Graphs are used in circuit networks where points of connection are drawn as vertices and component wires become the edges of the graph. Graphs are used in transport networks where stations are drawn as vertices and routes become the edges of the graph. Graphs are used in maps that draw cities/states/regions as vertices and adjacency relations as edges. Graphs are used in program flow analysis where procedures or modules are treated…

Read More

Differentiate among cycle, path, and circuit?

Post Views: 48,235 Path: A Path is the sequence of adjacent vertices connected by the edges with no restrictions. Cycle: A Cycle can be defined as the closed path where the initial vertex is identical to the end vertex. Any vertex in the path can not be visited twice Circuit: A Circuit can be defined as the closed path where the intial vertex is identical to the end vertex. Any vertex may be repeated.

Read More

Define the graph data structure?

Post Views: 48,236 A graph G can be defined as an ordered set G(V, E) where V(G) represents the set of vertices and E(G) represents the set of edges which are used to connect these vertices. A graph can be seen as a cyclic tree, where the vertices (Nodes) maintain any complex relationship among them instead of having parent-child relations.

Read More