BFS & DFS

A traversal is a systematic walk which visits the nodes of the graph in a specific order. Two Types:- 1.Breadth First Traversal 2.Depth First Traversal Breadth First Traversal- It traverses the successors of the start node,generation after generation in a horizontal or linear fashion. Algorithm- BFT(s) { //s is the start vertex of the traversal […]

Continue reading →

Binary Search

This is a short note on using binary search, in continuance of my series on Algorithms. Suppose we have to find whether a particular element exists in the sorted list of N numbers or not. Let “arr” be the array which contains the N elements and the element to be searched is “key”. Then, the […]

Continue reading →