first commit

main
syneffort 2 years ago
parent 7642d89035
commit 398c8d85cc
  1. 24
      DataStructure/.vscode/launch.json
  2. 41
      DataStructure/.vscode/tasks.json
  3. 40
      DataStructure/dataStructure.sln
  4. 2
      DataStructure/graphStructure/Program.cs
  5. 10
      DataStructure/graphStructure/graphStructure.csproj
  6. 2
      DataStructure/hashTableStructure/Program.cs
  7. 10
      DataStructure/hashTableStructure/hashTableStructure.csproj
  8. 2
      DataStructure/heapStructure/Program.cs
  9. 10
      DataStructure/heapStructure/heapStructure.csproj
  10. 16
      DataStructure/treeStructure/Program.cs
  11. 46
      DataStructure/treeStructure/Structure/UseConcurrentDictionary.cs
  12. 19
      DataStructure/treeStructure/Structure/UseDictionary.cs
  13. 18
      DataStructure/treeStructure/Structure/UseHashTable.cs
  14. 10
      DataStructure/treeStructure/treeStructure.csproj

@ -0,0 +1,24 @@
{
// IntelliSense .
// .
// https://go.microsoft.com/fwlink/?linkid=830387() .
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/treeStructure/bin/Debug/net7.0/treeStructure.dll",
"args": [],
"cwd": "${workspaceFolder}/treeStructure",
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}

@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/treeStructure/treeStructure.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/treeStructure/treeStructure.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/treeStructure/treeStructure.csproj"
],
"problemMatcher": "$msCompile"
}
]
}

@ -0,0 +1,40 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "hashTableStructure", "hashTableStructure\hashTableStructure.csproj", "{BCDB71EB-A69C-4A7E-922D-B4B0A2EA381B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "treeStructure", "treeStructure\treeStructure.csproj", "{C5273712-749A-4975-A15D-943673D43F57}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "graphStructure", "graphStructure\graphStructure.csproj", "{DE34364A-4934-4ACE-9BF0-742FCA7B2B2B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "heapStructure", "heapStructure\heapStructure.csproj", "{45886642-579F-4EB2-8314-E41558743140}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BCDB71EB-A69C-4A7E-922D-B4B0A2EA381B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BCDB71EB-A69C-4A7E-922D-B4B0A2EA381B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BCDB71EB-A69C-4A7E-922D-B4B0A2EA381B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BCDB71EB-A69C-4A7E-922D-B4B0A2EA381B}.Release|Any CPU.Build.0 = Release|Any CPU
{C5273712-749A-4975-A15D-943673D43F57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C5273712-749A-4975-A15D-943673D43F57}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C5273712-749A-4975-A15D-943673D43F57}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C5273712-749A-4975-A15D-943673D43F57}.Release|Any CPU.Build.0 = Release|Any CPU
{DE34364A-4934-4ACE-9BF0-742FCA7B2B2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DE34364A-4934-4ACE-9BF0-742FCA7B2B2B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE34364A-4934-4ACE-9BF0-742FCA7B2B2B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE34364A-4934-4ACE-9BF0-742FCA7B2B2B}.Release|Any CPU.Build.0 = Release|Any CPU
{45886642-579F-4EB2-8314-E41558743140}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{45886642-579F-4EB2-8314-E41558743140}.Debug|Any CPU.Build.0 = Debug|Any CPU
{45886642-579F-4EB2-8314-E41558743140}.Release|Any CPU.ActiveCfg = Release|Any CPU
{45886642-579F-4EB2-8314-E41558743140}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

@ -0,0 +1,2 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

@ -0,0 +1,2 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

@ -0,0 +1,2 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

@ -0,0 +1,16 @@
using treeStructure.Structure;
namespace treeStructure
{
static class Program
{
static void Main(string[] args)
{
//UseHashTable.DoWork();
// UseDictionary.DoWork();
UseConcurrentDictionary.DoWork();
}
}
}

@ -0,0 +1,46 @@
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
namespace treeStructure.Structure
{
public class UseConcurrentDictionary
{
public static void DoWork()
{
ConcurrentDictionary<int, string> dict = new ConcurrentDictionary<int, string>();
Task t1 = Task.Factory.StartNew(() =>
{
int key = 1;
while (key <= 100)
{
if (dict.TryAdd(key, $"D{key}"))
key++;
Thread.Sleep(100);
}
});
Task t2 = Task.Factory.StartNew(() =>
{
int key = 1;
string val;
while (key <= 100)
{
if (dict.TryGetValue(key, out val))
{
Console.WriteLine($"[{key}] {val}");
key++;
}
Thread.Sleep(100);
}
});
Task.WaitAll(t1, t2);
}
}
}

@ -0,0 +1,19 @@
using System;
using System.Collections;
namespace treeStructure.Structure
{
public class UseDictionary
{
public static void DoWork()
{
Dictionary<int, string> emp = new Dictionary<int, string>();
emp.Add(1001, "Jane");
emp.Add(1002, "Tom");
emp.Add(1003, "Cindy");
string name = emp[1002];
Console.WriteLine(name);
}
}
}

@ -0,0 +1,18 @@
using System;
using System.Collections;
namespace treeStructure.Structure
{
public class UseHashTable
{
public static void DoWork()
{
Hashtable ht = new Hashtable();
ht.Add("irina", "Irina SP");
ht.Add("tom", "Tom cr");
if (ht.Contains("tom"))
Console.WriteLine(ht["tom"]);
}
}
}

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
Loading…
Cancel
Save