Algorithm for vector problem
<p>What would be the best algorithm for the undermentioned problem.</p>

<p>Implement method PrintFamilyTree() that prints out the Name and Generation of the tree<br>
Output should resemble<br>
Name: Jan Generation:0<br>
Name: Mike Generation:1<br>
Name: Greg Generation:2<br>
Name: Carol: Generation: 2<br>
Name: Peter Generation: 3<br>
Name: Marcia Generation: 3<br>
Name: Bobby Generation: 1   </p>

<pre><code>class Human : public std::vector&lt;Human *&gt;
{
public:
Human(const std::string &amp;name) : m_Name(name) {};
virtual void PrintFamilyTree(const short &amp;generation = 0) const;
protected:
std::string m_Name;
};

class Male: public Human
{
public:
Male(const std::string &amp;name) : Human(name) {};
};

class Female: public Human
{
public:
Female(const std::string &amp;name) : Human(name) {};
};

void main()
{
Male m1("Mike"), m2("Greg"), m3("Peter"), m4("Bobby");
Female f1("Carol"), f2("Marcia"), f3("Jan");

m1.push_back(&amp;m2);
f1.push_back(&amp;m3);
f1.push_back(&amp;f2);
m1.push_back(&amp;f1);
f3.push_back(&amp;m1);
f3.push_back(&amp;m4);

f3.PrintFamilyTree();
}
</code></pre>
