Category : graph-algorithm

There are n cities and m possible roads and k temples. The cost of each road is given. Build roads with minimum cost such that each city has access to at least 1 temple. Note Input : There can be multiple roads(edges) between two cities. The first line contains n, m and k. And the ..

Read more

So there’s an algorithm to find the minimum cash flow among people (ie: to find the minimum number of transactions among people ) (source :https://www.geeksforgeeks.org/minimize-cash-flow-among-given-set-friends-borrowed-money/) But the algorithm isn’t completely accurate Consider the following test case : enter image description here When you input this the output says that there must be 5 transactions however ..

Read more

The problem statement is to create a binary tree from a given array of numbers (‘val’) and letters (‘name’) in level-order fashion. The problem however, is that the array can also contain ‘-1 N’ entries, which means that particular Node should be left empty (NULL), and the level order filling should continue from the next ..

Read more