The idea is that if you have a vertex having more than 4 leaves in the tree you could never take it in your final path. The steps of the Algorithm is as follows:


Delete the vertices having more than 4 leaves and the edges incident on them. 
By deleting those vertices and edges you'll get a forest having trees say T1,...,Tk. 
Then find simply the biggest path in each of those trees.
Take the maximum over all of those paths.


In 1st step you can keep a counter for all the vertices. Add one to the counters of the neighbors of each leaf. Delete the vertices having counter value > 4. So, it takes O(n) time.

Now in 3rd step finding a biggest path in a tree is straightforward using DFS.

Thus in total it takes O(n) time.

Find a maximal subgraph on a tree with conditions
I have an MCU Cortex M4 that don't have any internal voltage reference but only external. I need to setup a reference on ADVREF pin.

I found different schematics used:

Ex. 1:



Ex. 2:



Ex. 3:



Datasheet Details:



My questions are:


Can you explain me difference in this 3 example?
In ex.3, if I apply a 3.3v to LM4040 with a 2.2k Resistor, I'll still have 3.0v?
Since circuit will work in an environment with EMIs(I don't know which freq. may affect an ADVREF) and I need a small factor/minimal components, which one do you advice me? Or can you advice me another method?

