Mark As Completed Discussion

Concluding Remarks

The 2 coloring problem requires the processing of each node of the graph. For each node, we have to check its adjacent nodes. Depending upon which data structure is used to implement the graph, the time complexity of the above procedure would vary. If an adjacency list is used, then the time complexity is O(nk), where k is the maximum degree of all nodes of the graph. For an adjacency matrix, the time complexity would be O(n^2).