int rec(Nod n) { int c = 1; for (int i = 0; i < n.Nodes.Count; i++) { c += rec((Nod)n.Nodes[i]); } textBox1.Text = c.ToString(); return(c); }
private void Form1_Load(object sender, EventArgs e) { Loader l = new Loader(); l.ShowDialog(); Nod nd = new Nod("Start node", true); treeView1.Nodes.Add(nd); }
int gmd(Nod n, int md) { if (md < n.Level) { md = n.Level; } for (int i = 0; i < n.Nodes.Count; i++) { if (md < gmd((Nod)n.Nodes[i], md)) { md = gmd((Nod)n.Nodes[i], md); } } textBox2.Text = md.ToString(); return(md); }
Nod s(Nod n, string name) { Nod tmp = null; if (n.Text == name) { tmp = n; treeView1.SelectedNode = tmp; } else { for (int i = 0; i < n.Nodes.Count; i++) { tmp = s((Nod)n.Nodes[i], name); } } return(tmp); }