diff --git a/20241205/ConsoleApp1/.vs/ConsoleApp1/FileContentIndex/d0da49ce-25e9-4966-8b46-b84eaad93d20.vsidx b/20241205/ConsoleApp1/.vs/ConsoleApp1/FileContentIndex/d0da49ce-25e9-4966-8b46-b84eaad93d20.vsidx new file mode 100644 index 0000000..f69ec14 Binary files /dev/null and b/20241205/ConsoleApp1/.vs/ConsoleApp1/FileContentIndex/d0da49ce-25e9-4966-8b46-b84eaad93d20.vsidx differ diff --git a/20241205/ConsoleApp1/.vs/ConsoleApp1/v17/.suo b/20241205/ConsoleApp1/.vs/ConsoleApp1/v17/.suo new file mode 100644 index 0000000..7d04d3f Binary files /dev/null and b/20241205/ConsoleApp1/.vs/ConsoleApp1/v17/.suo differ diff --git a/20241205/ConsoleApp1/.vs/ConsoleApp1/v17/DocumentLayout.backup.json b/20241205/ConsoleApp1/.vs/ConsoleApp1/v17/DocumentLayout.backup.json new file mode 100644 index 0000000..5f686cf --- /dev/null +++ b/20241205/ConsoleApp1/.vs/ConsoleApp1/v17/DocumentLayout.backup.json @@ -0,0 +1,37 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20241205\\ConsoleApp1\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{3E313FF3-0218-494E-AC7C-7DA45B440762}|ConsoleApp1\\ConsoleApp1.csproj|c:\\users\\szabomarton\\desktop\\c#\\progaora\\20241205\\consoleapp1\\consoleapp1\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{3E313FF3-0218-494E-AC7C-7DA45B440762}|ConsoleApp1\\ConsoleApp1.csproj|solutionrelative:consoleapp1\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + } + ], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 200, + "SelectedChildIndex": 0, + "Children": [ + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "Program.cs", + "DocumentMoniker": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20241205\\ConsoleApp1\\ConsoleApp1\\Program.cs", + "RelativeDocumentMoniker": "ConsoleApp1\\Program.cs", + "ToolTip": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20241205\\ConsoleApp1\\ConsoleApp1\\Program.cs", + "RelativeToolTip": "ConsoleApp1\\Program.cs", + "ViewState": "AgIAALAAAAAAAAAAAAAAwMgAAAAfAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-12-05T07:15:35.651Z", + "EditorCaption": "" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/20241205/ConsoleApp1/.vs/ConsoleApp1/v17/DocumentLayout.json b/20241205/ConsoleApp1/.vs/ConsoleApp1/v17/DocumentLayout.json new file mode 100644 index 0000000..958cbbf --- /dev/null +++ b/20241205/ConsoleApp1/.vs/ConsoleApp1/v17/DocumentLayout.json @@ -0,0 +1,37 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20241205\\ConsoleApp1\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{3E313FF3-0218-494E-AC7C-7DA45B440762}|ConsoleApp1\\ConsoleApp1.csproj|c:\\users\\szabomarton\\desktop\\c#\\progaora\\20241205\\consoleapp1\\consoleapp1\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{3E313FF3-0218-494E-AC7C-7DA45B440762}|ConsoleApp1\\ConsoleApp1.csproj|solutionrelative:consoleapp1\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + } + ], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 200, + "SelectedChildIndex": 0, + "Children": [ + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "Program.cs", + "DocumentMoniker": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20241205\\ConsoleApp1\\ConsoleApp1\\Program.cs", + "RelativeDocumentMoniker": "ConsoleApp1\\Program.cs", + "ToolTip": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20241205\\ConsoleApp1\\ConsoleApp1\\Program.cs", + "RelativeToolTip": "ConsoleApp1\\Program.cs", + "ViewState": "AgIAAKIAAAAAAAAAAAAmwMoAAAAFAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-12-05T07:15:35.651Z", + "EditorCaption": "" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/20241205/ConsoleApp1/ConsoleApp1.sln b/20241205/ConsoleApp1/ConsoleApp1.sln new file mode 100644 index 0000000..9c3fa2d --- /dev/null +++ b/20241205/ConsoleApp1/ConsoleApp1.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35222.181 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{3E313FF3-0218-494E-AC7C-7DA45B440762}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3E313FF3-0218-494E-AC7C-7DA45B440762}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3E313FF3-0218-494E-AC7C-7DA45B440762}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3E313FF3-0218-494E-AC7C-7DA45B440762}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3E313FF3-0218-494E-AC7C-7DA45B440762}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {58E901D8-625F-4A3B-88D1-2A59133F4819} + EndGlobalSection +EndGlobal diff --git a/20241205/ConsoleApp1/ConsoleApp1/App.config b/20241205/ConsoleApp1/ConsoleApp1/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/20241205/ConsoleApp1/ConsoleApp1/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/20241205/ConsoleApp1/ConsoleApp1/ConsoleApp1.csproj b/20241205/ConsoleApp1/ConsoleApp1/ConsoleApp1.csproj new file mode 100644 index 0000000..f197707 --- /dev/null +++ b/20241205/ConsoleApp1/ConsoleApp1/ConsoleApp1.csproj @@ -0,0 +1,53 @@ + + + + + Debug + AnyCPU + {3E313FF3-0218-494E-AC7C-7DA45B440762} + Exe + ConsoleApp1 + ConsoleApp1 + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/20241205/ConsoleApp1/ConsoleApp1/Program.cs b/20241205/ConsoleApp1/ConsoleApp1/Program.cs new file mode 100644 index 0000000..2d903ed --- /dev/null +++ b/20241205/ConsoleApp1/ConsoleApp1/Program.cs @@ -0,0 +1,204 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp1 +{ + public class Csomopont + { + public int Adat { get; set; } + public Csomopont Bal { get; set; } + public Csomopont Jobb { get; set; } + public Csomopont(int adat) { + Adat = adat; + Bal = null; + Jobb = null; + } + } + + public class BinFa + { + public Csomopont Gyoker { get; private set; } + + public void Beszuras(int adat) + { + Gyoker = BeszurasRekurziv(Gyoker, adat); + } + + private Csomopont BeszurasRekurziv(Csomopont csomopont, int adat) + { + if (csomopont == null) + { + return new Csomopont(adat); + } + + if (adat < csomopont.Adat) + { + csomopont.Bal = BeszurasRekurziv(csomopont.Bal, adat); + } + else if (adat > csomopont.Adat) + { + csomopont.Jobb = BeszurasRekurziv(csomopont.Jobb, adat); + } + return csomopont; + } + + public bool Kereses(int adat) + { + return KeresesRekurziv(Gyoker, adat); + } + + private bool KeresesRekurziv(Csomopont csomopont, int adat) + { + if (csomopont == null) + { + return false; + } + + if (adat == csomopont.Adat) + { + return true; + } + + return + adat < csomopont.Adat + ? KeresesRekurziv(csomopont.Bal, adat) + : KeresesRekurziv(csomopont.Jobb, adat); + } + + public void Torles(int adat) + { + Gyoker = TorlesRekurziv(Gyoker, adat); + } + + private Csomopont TorlesRekurziv(Csomopont csomopont, int adat) { + if (csomopont == null) + { + return null; + } + + if (adat < csomopont.Adat) + { + csomopont.Bal = TorlesRekurziv(csomopont.Bal, adat); + } else if (adat > csomopont.Adat) + { + csomopont.Jobb = TorlesRekurziv(csomopont.Jobb, adat); + } else + { + if (csomopont.Bal == null && csomopont.Jobb == null) + { + return null ; + } + + if (csomopont.Bal == null) + { + return csomopont.Jobb; + } + + if (csomopont.Jobb == null) + { + return csomopont.Bal; + } + + csomopont.Adat = MinimumErtek(csomopont.Jobb); + csomopont.Jobb = TorlesRekurziv(csomopont.Jobb, csomopont.Adat); + } + return csomopont; + } + + private int MinimumErtek(Csomopont csomopont) + { + while (csomopont.Bal != null) + { + csomopont = csomopont.Bal; + } + + return csomopont.Adat; + } + + public void InorderBejaras() + { + Console.WriteLine("Inorder bejárás:"); + InorderRekurziv(Gyoker); + Console.WriteLine(); + } + + private void InorderRekurziv(Csomopont csomopont) + { + if (csomopont == null) + { + return; + } + + InorderRekurziv(csomopont.Bal); + Console.WriteLine(csomopont.Adat + " "); + InorderRekurziv(csomopont.Jobb); + } + + public void PreorderBejaras() + { + Console.WriteLine("Preorder bejárás: "); + PreorderRekurziv(Gyoker); + Console.WriteLine(); + } + + private void PreorderRekurziv(Csomopont csomopont) + { + if (csomopont == null) + { + return; + } + Console.WriteLine(csomopont.Adat + " "); + PreorderRekurziv(csomopont.Bal); + PreorderRekurziv(csomopont.Jobb); + } + + public void PostorderBejaras() + { + Console.WriteLine("Postorder bejárás: "); + PostorderRekurziv(Gyoker); + Console.WriteLine(); + } + + private void PostorderRekurziv(Csomopont csomopont) + { + if (csomopont == null) + { + return; + } + PostorderRekurziv(csomopont.Bal); + PostorderRekurziv(csomopont.Jobb); + Console.WriteLine(csomopont.Adat + " "); + } + } + internal class Program + { + static void Main(string[] args) + { + BinFa fa = new BinFa(); + + fa.Beszuras(50); + fa.Beszuras(30); + fa.Beszuras(70); + fa.Beszuras(20); + fa.Beszuras(40); + fa.Beszuras(60); + fa.Beszuras(80); + + fa.InorderBejaras(); + fa.PreorderBejaras(); + fa.PostorderBejaras(); + + Console.WriteLine($"\nKeresés 40 {fa.Kereses(40)}"); + Console.WriteLine($"\nKeresés 100 {fa.Kereses(100)}"); + + Console.WriteLine("\nTörlés 50 (gyökér):"); + fa.Torles(50); + fa.InorderBejaras(); + + Console.ReadLine(); + } + } +} diff --git a/20241205/ConsoleApp1/ConsoleApp1/Properties/AssemblyInfo.cs b/20241205/ConsoleApp1/ConsoleApp1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..efb4fff --- /dev/null +++ b/20241205/ConsoleApp1/ConsoleApp1/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ConsoleApp1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ConsoleApp1")] +[assembly: AssemblyCopyright("Copyright © 2024")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3e313ff3-0218-494e-ac7c-7da45b440762")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/20241205/ConsoleApp1/ConsoleApp1/bin/Debug/ConsoleApp1.exe b/20241205/ConsoleApp1/ConsoleApp1/bin/Debug/ConsoleApp1.exe new file mode 100644 index 0000000..d7d20f0 Binary files /dev/null and b/20241205/ConsoleApp1/ConsoleApp1/bin/Debug/ConsoleApp1.exe differ diff --git a/20241205/ConsoleApp1/ConsoleApp1/bin/Debug/ConsoleApp1.exe.config b/20241205/ConsoleApp1/ConsoleApp1/bin/Debug/ConsoleApp1.exe.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/20241205/ConsoleApp1/ConsoleApp1/bin/Debug/ConsoleApp1.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/20241205/ConsoleApp1/ConsoleApp1/bin/Debug/ConsoleApp1.pdb b/20241205/ConsoleApp1/ConsoleApp1/bin/Debug/ConsoleApp1.pdb new file mode 100644 index 0000000..b3e281c Binary files /dev/null and b/20241205/ConsoleApp1/ConsoleApp1/bin/Debug/ConsoleApp1.pdb differ diff --git a/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs b/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs new file mode 100644 index 0000000..3871b18 --- /dev/null +++ b/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] diff --git a/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.AssemblyReference.cache b/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.AssemblyReference.cache new file mode 100644 index 0000000..126ed02 Binary files /dev/null and b/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.AssemblyReference.cache differ diff --git a/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.CoreCompileInputs.cache b/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..0be8d26 --- /dev/null +++ b/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +137ddb1975586287657f37337b64d051167bb6a147915d9fb5b8eb94b1093509 diff --git a/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.FileListAbsolute.txt b/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..2bcb8b1 --- /dev/null +++ b/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.FileListAbsolute.txt @@ -0,0 +1,7 @@ +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241205\ConsoleApp1\ConsoleApp1\bin\Debug\ConsoleApp1.exe.config +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241205\ConsoleApp1\ConsoleApp1\bin\Debug\ConsoleApp1.exe +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241205\ConsoleApp1\ConsoleApp1\bin\Debug\ConsoleApp1.pdb +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241205\ConsoleApp1\ConsoleApp1\obj\Debug\ConsoleApp1.csproj.AssemblyReference.cache +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241205\ConsoleApp1\ConsoleApp1\obj\Debug\ConsoleApp1.csproj.CoreCompileInputs.cache +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241205\ConsoleApp1\ConsoleApp1\obj\Debug\ConsoleApp1.exe +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241205\ConsoleApp1\ConsoleApp1\obj\Debug\ConsoleApp1.pdb diff --git a/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.exe b/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.exe new file mode 100644 index 0000000..d7d20f0 Binary files /dev/null and b/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.exe differ diff --git a/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.pdb b/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.pdb new file mode 100644 index 0000000..b3e281c Binary files /dev/null and b/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.pdb differ diff --git a/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..456382f Binary files /dev/null and b/20241205/ConsoleApp1/ConsoleApp1/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/20241205/Hash/.vs/Hash/FileContentIndex/2737ca1a-ea31-47ed-98f7-180864e23f91.vsidx b/20241205/Hash/.vs/Hash/FileContentIndex/2737ca1a-ea31-47ed-98f7-180864e23f91.vsidx new file mode 100644 index 0000000..65d9d42 Binary files /dev/null and b/20241205/Hash/.vs/Hash/FileContentIndex/2737ca1a-ea31-47ed-98f7-180864e23f91.vsidx differ diff --git a/20241205/Hash/.vs/Hash/v17/.suo b/20241205/Hash/.vs/Hash/v17/.suo new file mode 100644 index 0000000..231b97c Binary files /dev/null and b/20241205/Hash/.vs/Hash/v17/.suo differ diff --git a/20241205/Hash/.vs/Hash/v17/DocumentLayout.backup.json b/20241205/Hash/.vs/Hash/v17/DocumentLayout.backup.json new file mode 100644 index 0000000..4e09056 --- /dev/null +++ b/20241205/Hash/.vs/Hash/v17/DocumentLayout.backup.json @@ -0,0 +1,37 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20241205\\Hash\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{92516C8E-806E-45BE-ACCB-4559FE78302C}|Hash\\Hash.csproj|c:\\users\\szabomarton\\desktop\\c#\\progaora\\20241205\\hash\\hash\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{92516C8E-806E-45BE-ACCB-4559FE78302C}|Hash\\Hash.csproj|solutionrelative:hash\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + } + ], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 200, + "SelectedChildIndex": 0, + "Children": [ + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "Program.cs", + "DocumentMoniker": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20241205\\Hash\\Hash\\Program.cs", + "RelativeDocumentMoniker": "Hash\\Program.cs", + "ToolTip": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20241205\\Hash\\Hash\\Program.cs", + "RelativeToolTip": "Hash\\Program.cs", + "ViewState": "AgIAADwAAAAAAAAAAAAYwFAAAABAAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-12-05T08:51:30.103Z", + "EditorCaption": "" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/20241205/Hash/.vs/Hash/v17/DocumentLayout.json b/20241205/Hash/.vs/Hash/v17/DocumentLayout.json new file mode 100644 index 0000000..4e09056 --- /dev/null +++ b/20241205/Hash/.vs/Hash/v17/DocumentLayout.json @@ -0,0 +1,37 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20241205\\Hash\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{92516C8E-806E-45BE-ACCB-4559FE78302C}|Hash\\Hash.csproj|c:\\users\\szabomarton\\desktop\\c#\\progaora\\20241205\\hash\\hash\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{92516C8E-806E-45BE-ACCB-4559FE78302C}|Hash\\Hash.csproj|solutionrelative:hash\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + } + ], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 200, + "SelectedChildIndex": 0, + "Children": [ + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "Program.cs", + "DocumentMoniker": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20241205\\Hash\\Hash\\Program.cs", + "RelativeDocumentMoniker": "Hash\\Program.cs", + "ToolTip": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20241205\\Hash\\Hash\\Program.cs", + "RelativeToolTip": "Hash\\Program.cs", + "ViewState": "AgIAADwAAAAAAAAAAAAYwFAAAABAAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-12-05T08:51:30.103Z", + "EditorCaption": "" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/20241205/Hash/Hash.sln b/20241205/Hash/Hash.sln new file mode 100644 index 0000000..1e380e4 --- /dev/null +++ b/20241205/Hash/Hash.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35222.181 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hash", "Hash\Hash.csproj", "{92516C8E-806E-45BE-ACCB-4559FE78302C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {92516C8E-806E-45BE-ACCB-4559FE78302C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {92516C8E-806E-45BE-ACCB-4559FE78302C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {92516C8E-806E-45BE-ACCB-4559FE78302C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {92516C8E-806E-45BE-ACCB-4559FE78302C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B43D832E-530B-49AE-891B-D0BD251A9CE5} + EndGlobalSection +EndGlobal diff --git a/20241205/Hash/Hash/App.config b/20241205/Hash/Hash/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/20241205/Hash/Hash/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/20241205/Hash/Hash/Hash.csproj b/20241205/Hash/Hash/Hash.csproj new file mode 100644 index 0000000..63a87fd --- /dev/null +++ b/20241205/Hash/Hash/Hash.csproj @@ -0,0 +1,53 @@ + + + + + Debug + AnyCPU + {92516C8E-806E-45BE-ACCB-4559FE78302C} + Exe + Hash + Hash + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/20241205/Hash/Hash/Program.cs b/20241205/Hash/Hash/Program.cs new file mode 100644 index 0000000..31fa0a3 --- /dev/null +++ b/20241205/Hash/Hash/Program.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace Hash +{ + internal class Program + { + static void Main(string[] args) + { + Hashtable hashtable = new Hashtable(); + hashtable.Add("A1", "Welcome"); + hashtable.Add("A2", "to"); + hashtable.Add("A3", "Hell"); + + if (hashtable.Contains("A2")) + { + Console.WriteLine("Contains"); + } else + { + Console.WriteLine("Not contains"); + } + + if (hashtable.ContainsValue("Hell")) + { + Console.WriteLine("Contains"); + } + else + { + Console.WriteLine("Not contains"); + } + + + + hashtable.Remove("A2"); + + if (hashtable.ContainsKey("A2")) + { + Console.WriteLine("Contains"); + } + else + { + Console.WriteLine("Not contains"); + } + + Console.WriteLine("Key and Value pairs from hashtable:"); + + + + + foreach (DictionaryEntry element in hashtable) { + Console.WriteLine($"Key: {element.Key}, Value: {element.Value}"); + } + + Hashtable hashtable2 = new Hashtable() + { + {1, "Hello" }, + {2, 234 }, + {3, 230.45 }, + {4, null } + }; + + hashtable2.Clear(); + + foreach (var element in hashtable2.Keys) { + Console.WriteLine($"Key: {element}, Value: {hashtable2[element]}"); + } + + string keyToUpdate = "A1"; + + if (hashtable.ContainsKey(keyToUpdate)) + { + hashtable[keyToUpdate] = "new value"; + } + + string updatedValue = (string)hashtable[keyToUpdate]; + Console.WriteLine($"Updated value: {updatedValue}"); + + + Console.ReadLine(); + } + } +} diff --git a/20241205/Hash/Hash/Properties/AssemblyInfo.cs b/20241205/Hash/Hash/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7993572 --- /dev/null +++ b/20241205/Hash/Hash/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Hash")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Hash")] +[assembly: AssemblyCopyright("Copyright © 2024")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("92516c8e-806e-45be-accb-4559fe78302c")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/20241205/Hash/Hash/bin/Debug/Hash.exe b/20241205/Hash/Hash/bin/Debug/Hash.exe new file mode 100644 index 0000000..7a731c0 Binary files /dev/null and b/20241205/Hash/Hash/bin/Debug/Hash.exe differ diff --git a/20241205/Hash/Hash/bin/Debug/Hash.exe.config b/20241205/Hash/Hash/bin/Debug/Hash.exe.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/20241205/Hash/Hash/bin/Debug/Hash.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/20241205/Hash/Hash/bin/Debug/Hash.pdb b/20241205/Hash/Hash/bin/Debug/Hash.pdb new file mode 100644 index 0000000..ae5e8ad Binary files /dev/null and b/20241205/Hash/Hash/bin/Debug/Hash.pdb differ diff --git a/20241205/Hash/Hash/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs b/20241205/Hash/Hash/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs new file mode 100644 index 0000000..3871b18 --- /dev/null +++ b/20241205/Hash/Hash/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] diff --git a/20241205/Hash/Hash/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/20241205/Hash/Hash/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..d1a7922 Binary files /dev/null and b/20241205/Hash/Hash/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/20241205/Hash/Hash/obj/Debug/Hash.csproj.AssemblyReference.cache b/20241205/Hash/Hash/obj/Debug/Hash.csproj.AssemblyReference.cache new file mode 100644 index 0000000..126ed02 Binary files /dev/null and b/20241205/Hash/Hash/obj/Debug/Hash.csproj.AssemblyReference.cache differ diff --git a/20241205/Hash/Hash/obj/Debug/Hash.csproj.CoreCompileInputs.cache b/20241205/Hash/Hash/obj/Debug/Hash.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..0be8d26 --- /dev/null +++ b/20241205/Hash/Hash/obj/Debug/Hash.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +137ddb1975586287657f37337b64d051167bb6a147915d9fb5b8eb94b1093509 diff --git a/20241205/Hash/Hash/obj/Debug/Hash.csproj.FileListAbsolute.txt b/20241205/Hash/Hash/obj/Debug/Hash.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..104cf89 --- /dev/null +++ b/20241205/Hash/Hash/obj/Debug/Hash.csproj.FileListAbsolute.txt @@ -0,0 +1,7 @@ +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241205\Hash\Hash\bin\Debug\Hash.exe.config +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241205\Hash\Hash\bin\Debug\Hash.exe +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241205\Hash\Hash\bin\Debug\Hash.pdb +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241205\Hash\Hash\obj\Debug\Hash.csproj.AssemblyReference.cache +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241205\Hash\Hash\obj\Debug\Hash.csproj.CoreCompileInputs.cache +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241205\Hash\Hash\obj\Debug\Hash.exe +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241205\Hash\Hash\obj\Debug\Hash.pdb diff --git a/20241205/Hash/Hash/obj/Debug/Hash.exe b/20241205/Hash/Hash/obj/Debug/Hash.exe new file mode 100644 index 0000000..7a731c0 Binary files /dev/null and b/20241205/Hash/Hash/obj/Debug/Hash.exe differ diff --git a/20241205/Hash/Hash/obj/Debug/Hash.pdb b/20241205/Hash/Hash/obj/Debug/Hash.pdb new file mode 100644 index 0000000..ae5e8ad Binary files /dev/null and b/20241205/Hash/Hash/obj/Debug/Hash.pdb differ diff --git a/20241205/ÓraiBinFa1129.pdf b/20241205/ÓraiBinFa1129.pdf new file mode 100644 index 0000000..35122a7 Binary files /dev/null and b/20241205/ÓraiBinFa1129.pdf differ diff --git a/adatstrukturak b/adatstrukturak index e54fc8f..b9b9f89 100644 --- a/adatstrukturak +++ b/adatstrukturak @@ -224,7 +224,34 @@ Verem osztály létrehoz egy Verem példányt 5 kapacitással. Bemutatja az összes műveletet, beleértve a verem túlcsordulásának és kiürítésének kezelését. +Fák +#TODO egészítsd ki ezt a részt +Hash függvény, Hash tábla, Hasító tábla + A hash egy rögzített hosszúságú érték, amelyet egy matematikai képlet segítségével állítanak elő. + A hash értékeket adattömörítésben, kriptológiában stb. használják. + Az adatindexelésében a hash értéket használjuk, mert rögzített hosszúságúak, függetlenül a generálásukhoz használt értékektől. + Lehetővé teszi, hogy a ...... + A hah fgvény egy matematikai algoritmust alkalmaz a kulcs hash-é alakítására. + Az ütközés akkor következik be, ha egy hash függvény ugyanazt a hash értéket állítja elő több kulcshoz. +Hash tábla + A hash tábla egy olyan adatstruktúra, amely kulcs értékpár használatával értéket tárol. + Minden értékhez egydi kulcs van hozzárendelve, amelyet egy hash függvény segítségével állítanak elő. + A kulcs neve a hozzá tartozó érték elérésére szolgál. + Ez nagyon felgyorsítja az értlkek keresését a hash táblában, + függetlenül a hash táblában lévő elemek számától. + +Hash funkciók + Például, ha az alkalmazottak nyilvántartásait szeretnénk tárolni, + és minden alkalmazott egyedileg azonosítható egy alkalmazotti szám segítségével. + Kulcsként használhatjuk az alkalmazotti számot, + értékként a munkavállalói adatokat rendelhetjük hozzá. + + A hash függvény megoldja a fenti problémát azáltal, hogy lekéri az alkalmazottu számot, + és ennek segítségével generál egy hash egész értéket, + rögzített számjegyeket, és optimalizálja a tárhelyet. + A hash függvény célja egy kulcs létrehozása, amely a tárolni kívánt értékre hivatkozik. + A függvény elfogadja a mentendő értéket, majd egy algoritmus segítségével kiszámítja a kulcs értékét. \ No newline at end of file