DFS – Depth-First search algorithm

Categories: Algorithms

Depth–first search (DFS) is an algorithm for traversing or searching tree or graph data structures. The algorithm starts at the root node (selecting some arbitrary node as the root node in the case of a graph) and explores as far as possible along each branch before backtracking. Python Implementation

BFS – Breadth-first search algorithm

Categories: Algorithms

BFS is a traversing algorithm where you should start traversing from a selected node (source or starting node) and traverse the graph by exploring all the neighbour nodes (nodes which are directly connected to source node). You must then move towards the next-level neighbour nodes. Basically traversing the tree or graph layer by layer. Pseudocode […]

Find all the prime factors of a number

Categories: Algorithms

The main algorithm in the above program is the is_prime method. We should be able to check if a number is prime or not in the fastest way possible.