Categories
Coding Byte

Graphs: Understanding Kruskal’s Algorithm

What is Kruskal’s algorithm? Kruskal’s algorithm is used to find a minimum spanning forest or tree in an undirected graphs and connected graphs respectively. For graphs, minimum spanning trees are a subset of edges that form a tree which include all vertices, where the sum of all edges is kept to the smallest number possible. […]

Categories
Coding Byte

Binary Search: Deriving asymptotic analysis of the Binary Search Algorithm

How Does Binary Search Work? Binary search only works in sorted collections. It will thus be assumed that customer orders have been sorted before the implementation of the algorithm. Binary search works by recursively dividing a collection in halves, discarding the half that does not contain the element, and continuing to divide the portions that […]