Back to problems

Minimum Node Deletions to Limit N-ary Tree Height

Algorithm · Snowflake · Hard

You are given a rooted N-ary tree together with an upper limit N on its height. Choose a set of nodes to delete so that, once they are all removed, the height of the remaining tree does not exceed N, and make this set as small as possible. Removing a node u does not remove anything beneath it: every child of u is reattached directly to the parent of u, so the rest of the subtree survives. The root is never allowed to be removed. As the examples show, height is measured in…

Loading the rest of the question…