bracket system

This commit is contained in:
h z
2024-07-29 17:24:31 +01:00
parent 6c6cb45c84
commit 9126f98173
4 changed files with 32 additions and 2 deletions

View File

@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>disable</Nullable>
<Version>0.0.5</Version> <Version>0.0.5</Version>
<Description> </Description> <Description> </Description>
<Copyright>hzhang</Copyright> <Copyright>hzhang</Copyright>

View File

@@ -1,6 +1,6 @@
{ {
"sdk": { "sdk": {
"version": "6.0.0", "version": "8.0.0",
"rollForward": "latestMinor", "rollForward": "latestMinor",
"allowPrerelease": false "allowPrerelease": false
} }

View File

@@ -0,0 +1,11 @@
namespace Skeleton.DataStructure.Tree;
public class Tree<T>
{
public Tree(T root)
{
Root = new TreeNode<T>(root);
}
public TreeNode<T> Root { get; set; }
}

View File

@@ -0,0 +1,19 @@
namespace Skeleton.DataStructure.Tree;
public class TreeNode<T>
{
public static TreeNode<T> Null = null;
public TreeNode(T obj)
{
Value = obj;
Children = new();
}
public T Value { get; set; }
public HashSet<TreeNode<T>> Children { get; set; }
public void AddChild(T child)
{
Children.Add(new TreeNode<T>(child));
}
}