Optimal Tree Splitting and Greedy Algorithms

CppCodingZen
Level Up Coding

--

This post will tackle a problem of optimally splitting a tree (or removing edges from it), and will discuss how Greedy algorithms result in simple solution to the problem. The whole solution fits within about 40 lines of code.

Feel free to read a few older posts to read more on Greedy Algorithms.

Problem:

--

--

Solutions to programming interview questions at some of the top companies in the world: cppcodingzen.com