2022-04-11 18:00:34 +05:00
|
|
|
|
using System.Collections.Generic;
|
2021-12-22 11:41:18 +05:00
|
|
|
|
|
|
|
|
|
namespace AsbCloudApp
|
|
|
|
|
{
|
|
|
|
|
public class Tree<T> : Dictionary<T, Tree<T>>
|
|
|
|
|
{
|
|
|
|
|
public Tree()
|
2022-04-11 18:00:34 +05:00
|
|
|
|
{ }
|
2021-12-22 11:41:18 +05:00
|
|
|
|
|
|
|
|
|
public Tree(T key, Tree<T> node = null)
|
|
|
|
|
{
|
|
|
|
|
Add(key, node);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Tree(Tree<T> other)
|
2022-04-11 18:00:34 +05:00
|
|
|
|
: base(other)
|
|
|
|
|
{ }
|
2021-12-22 11:41:18 +05:00
|
|
|
|
|
|
|
|
|
public Tree(IEnumerable<T> keys)
|
|
|
|
|
{
|
|
|
|
|
foreach (var key in keys)
|
|
|
|
|
Add(key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Add(T key) => Add(key, null);
|
|
|
|
|
}
|
|
|
|
|
}
|