Your team at amazon is overseeing the design of a new high-efficiency data center at hq2. a power grid need to be generated for
supplying power to n servers. all servers in the grid have to be connected such that they have access to power. the cost of connections between different servers varies. assume that there are no ties, names of servers are unique, connections are directionless, there is at most one connection between a pair of servers, all costs are greater than zero, and a server does not connect to itself. write an algorithm to minimize the cost of connecting all servers in the power grid. input two arguments - num, an integer representing number of connections. connectons, representing a list of connections where each element of the list consists of two servers and the cost of connection between the servers. note: the cost of connection between the servers is always greater than 0.
example input num = 5 connection = [[a,b,1], [b,c,4], [b,d,6], [d,e,5], [c,e,1]]
output [[a,b,1], [b,c,4], [c,e,1], [d,e,5]]