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. […]
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 […]
In the knapsack problem, a thief is filling up their knapsack with items that weigh differently and have various weights. The thief must design an algorithm that will help them determine what combination of items to carry that have maximum value without breaking their knapsack that can only hold up to limited weight.