Strategy Factory

We have all heard about design patterns like factory pattern and strategy pattern and design principles like SOLID. If we are asked what is open closed principle we would immediately answer that it is a module, class or functionality in our software which is closed for modifications but open for extensions. However we often struggle … Continue reading Strategy Factory

Depth First Search (DFS) in a Graph

Depth first search is an algorithm which searches or traverses all the vertices in a graph. It starts to traverse the graph based on a start vertex. The algorithm traverses the vertices in depth. As graphs can have cycles we should not visit any visited vertex twice. For this purpose the algorithm must know if … Continue reading Depth First Search (DFS) in a Graph