Skip to content

Instantly share code, notes, and snippets.

@zekigurbuz
Created May 8, 2020 21:34
Show Gist options
  • Save zekigurbuz/8f5916e2308f018c3830d5474cf7a30b to your computer and use it in GitHub Desktop.
Save zekigurbuz/8f5916e2308f018c3830d5474cf7a30b to your computer and use it in GitHub Desktop.

The Universal Internet Lab (UIL) recently developed an ingenious new method of connecting its computers. Each computer is directly connected to some other set of computers such that there is exactly one sequence of connections between any pair of computers. Stated differently, by treating the computers as vertices and connections as edges, the computers and their connections form a tree.

While this may seem constraining, connecting computers in this manner has some benefits. For example, software updates can now be installed in a distributed manner. Instead of each computer connecting to some central server to download a software update, only one computer needs to be updated. Then, by using these connections between computers, one computer can update all the other computers directly or indirectly!

Here's how it works: consider a connection where one end of the connection has a computer with the update (hereafter referred to as the source) and a computer without the update (hereafter referred to as the sink). Then in L seconds, the sink can download and install the update from the source. Each sink can only download from a single source at a time, and each source can only be accessed by a single sink at a time.

At the beginning, only computer S has the update. If Ina chooses the optimal ordering for updates, what is the fastest that all computers can be updated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment