diff --git a/20241206/Dict/.vs/Dict/FileContentIndex/f587cb4a-3b07-40bc-91ac-1c309dedd31d.vsidx b/20241206/Dict/.vs/Dict/FileContentIndex/f587cb4a-3b07-40bc-91ac-1c309dedd31d.vsidx new file mode 100644 index 0000000..ad9497f Binary files /dev/null and b/20241206/Dict/.vs/Dict/FileContentIndex/f587cb4a-3b07-40bc-91ac-1c309dedd31d.vsidx differ diff --git a/20241206/Dict/.vs/Dict/v17/.suo b/20241206/Dict/.vs/Dict/v17/.suo new file mode 100644 index 0000000..cf3fb77 Binary files /dev/null and b/20241206/Dict/.vs/Dict/v17/.suo differ diff --git a/20241206/Dict/.vs/Dict/v17/DocumentLayout.backup.json b/20241206/Dict/.vs/Dict/v17/DocumentLayout.backup.json new file mode 100644 index 0000000..76316b3 --- /dev/null +++ b/20241206/Dict/.vs/Dict/v17/DocumentLayout.backup.json @@ -0,0 +1,41 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20241206\\Dict\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{967317FE-4484-4949-A884-C0A411A637E0}|Dict\\Dict.csproj|c:\\users\\szabomarton\\desktop\\c#\\progaora\\20241206\\dict\\dict\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{967317FE-4484-4949-A884-C0A411A637E0}|Dict\\Dict.csproj|solutionrelative:dict\\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\\20241206\\Dict\\Dict\\Program.cs", + "RelativeDocumentMoniker": "Dict\\Program.cs", + "ToolTip": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20241206\\Dict\\Dict\\Program.cs", + "RelativeToolTip": "Dict\\Program.cs", + "ViewState": "AgIAAAoAAAAAAAAAAAAowCUAAAAFAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-12-06T09:07:26.634Z", + "EditorCaption": "" + }, + { + "$type": "Bookmark", + "Name": "ST:0:0:{cce594b6-0c39-4442-ba28-10c64ac7e89f}" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/20241206/Dict/.vs/Dict/v17/DocumentLayout.json b/20241206/Dict/.vs/Dict/v17/DocumentLayout.json new file mode 100644 index 0000000..869a800 --- /dev/null +++ b/20241206/Dict/.vs/Dict/v17/DocumentLayout.json @@ -0,0 +1,41 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20241206\\Dict\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{967317FE-4484-4949-A884-C0A411A637E0}|Dict\\Dict.csproj|c:\\users\\szabomarton\\desktop\\c#\\progaora\\20241206\\dict\\dict\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{967317FE-4484-4949-A884-C0A411A637E0}|Dict\\Dict.csproj|solutionrelative:dict\\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\\20241206\\Dict\\Dict\\Program.cs", + "RelativeDocumentMoniker": "Dict\\Program.cs", + "ToolTip": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20241206\\Dict\\Dict\\Program.cs", + "RelativeToolTip": "Dict\\Program.cs", + "ViewState": "AgIAABYAAAAAAAAAAAAmwCMAAAANAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-12-06T09:07:26.634Z", + "EditorCaption": "" + }, + { + "$type": "Bookmark", + "Name": "ST:0:0:{cce594b6-0c39-4442-ba28-10c64ac7e89f}" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/20241206/Dict/Dict.sln b/20241206/Dict/Dict.sln new file mode 100644 index 0000000..b3dc333 --- /dev/null +++ b/20241206/Dict/Dict.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35303.130 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dict", "Dict\Dict.csproj", "{967317FE-4484-4949-A884-C0A411A637E0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {967317FE-4484-4949-A884-C0A411A637E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {967317FE-4484-4949-A884-C0A411A637E0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {967317FE-4484-4949-A884-C0A411A637E0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {967317FE-4484-4949-A884-C0A411A637E0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {6D04FCE6-86EC-47EB-8C6F-19513CBABCE4} + EndGlobalSection +EndGlobal diff --git a/20241206/Dict/Dict/App.config b/20241206/Dict/Dict/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/20241206/Dict/Dict/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/20241206/Dict/Dict/Dict.csproj b/20241206/Dict/Dict/Dict.csproj new file mode 100644 index 0000000..d0261da --- /dev/null +++ b/20241206/Dict/Dict/Dict.csproj @@ -0,0 +1,53 @@ + + + + + Debug + AnyCPU + {967317FE-4484-4949-A884-C0A411A637E0} + Exe + Dict + Dict + 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/20241206/Dict/Dict/Program.cs b/20241206/Dict/Dict/Program.cs new file mode 100644 index 0000000..8eba475 --- /dev/null +++ b/20241206/Dict/Dict/Program.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Dict +{ + internal class Program + { + static void Main(string[] args) + { + int[] szamok = new int[20]; + Random R = new Random(); + for (int i = 0; i < 20; i++) + { + szamok[i] = R.Next(10); + } + + Dictionary szamokSzama = new Dictionary(); + + for (int i = 0; i < szamok.Length; i++) + { + if (szamokSzama.ContainsKey(szamok[i])) + { + szamokSzama[szamok[i]]++; + } else + { + szamokSzama.Add(szamok[i], 1); + } + } + + foreach (KeyValuePair item in szamokSzama) + { + Console.WriteLine($"Kulcs: {item.Key}, Érték: {item.Value}"); + } + } + } +} diff --git a/20241206/Dict/Dict/Properties/AssemblyInfo.cs b/20241206/Dict/Dict/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..4fef04d --- /dev/null +++ b/20241206/Dict/Dict/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("Dict")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Dict")] +[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("967317fe-4484-4949-a884-c0a411a637e0")] + +// 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/20241206/Dict/Dict/bin/Debug/Dict.exe b/20241206/Dict/Dict/bin/Debug/Dict.exe new file mode 100644 index 0000000..62c1d85 Binary files /dev/null and b/20241206/Dict/Dict/bin/Debug/Dict.exe differ diff --git a/20241206/Dict/Dict/bin/Debug/Dict.exe.config b/20241206/Dict/Dict/bin/Debug/Dict.exe.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/20241206/Dict/Dict/bin/Debug/Dict.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/20241206/Dict/Dict/bin/Debug/Dict.pdb b/20241206/Dict/Dict/bin/Debug/Dict.pdb new file mode 100644 index 0000000..c9a5629 Binary files /dev/null and b/20241206/Dict/Dict/bin/Debug/Dict.pdb differ diff --git a/20241206/Dict/Dict/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs b/20241206/Dict/Dict/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs new file mode 100644 index 0000000..3871b18 --- /dev/null +++ b/20241206/Dict/Dict/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/20241206/Dict/Dict/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/20241206/Dict/Dict/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..b9bb55c Binary files /dev/null and b/20241206/Dict/Dict/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/20241206/Dict/Dict/obj/Debug/Dict.csproj.AssemblyReference.cache b/20241206/Dict/Dict/obj/Debug/Dict.csproj.AssemblyReference.cache new file mode 100644 index 0000000..126ed02 Binary files /dev/null and b/20241206/Dict/Dict/obj/Debug/Dict.csproj.AssemblyReference.cache differ diff --git a/20241206/Dict/Dict/obj/Debug/Dict.csproj.CoreCompileInputs.cache b/20241206/Dict/Dict/obj/Debug/Dict.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..0be8d26 --- /dev/null +++ b/20241206/Dict/Dict/obj/Debug/Dict.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +137ddb1975586287657f37337b64d051167bb6a147915d9fb5b8eb94b1093509 diff --git a/20241206/Dict/Dict/obj/Debug/Dict.csproj.FileListAbsolute.txt b/20241206/Dict/Dict/obj/Debug/Dict.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..658a283 --- /dev/null +++ b/20241206/Dict/Dict/obj/Debug/Dict.csproj.FileListAbsolute.txt @@ -0,0 +1,7 @@ +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241206\Dict\Dict\bin\Debug\Dict.exe.config +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241206\Dict\Dict\bin\Debug\Dict.exe +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241206\Dict\Dict\bin\Debug\Dict.pdb +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241206\Dict\Dict\obj\Debug\Dict.csproj.AssemblyReference.cache +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241206\Dict\Dict\obj\Debug\Dict.csproj.CoreCompileInputs.cache +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241206\Dict\Dict\obj\Debug\Dict.exe +C:\Users\szabomarton\Desktop\C#\ProgaOra\20241206\Dict\Dict\obj\Debug\Dict.pdb diff --git a/20241206/Dict/Dict/obj/Debug/Dict.exe b/20241206/Dict/Dict/obj/Debug/Dict.exe new file mode 100644 index 0000000..62c1d85 Binary files /dev/null and b/20241206/Dict/Dict/obj/Debug/Dict.exe differ diff --git a/20241206/Dict/Dict/obj/Debug/Dict.pdb b/20241206/Dict/Dict/obj/Debug/Dict.pdb new file mode 100644 index 0000000..c9a5629 Binary files /dev/null and b/20241206/Dict/Dict/obj/Debug/Dict.pdb differ diff --git a/adatstrukturak b/adatstrukturak index b9b9f89..61d9029 100644 --- a/adatstrukturak +++ b/adatstrukturak @@ -254,4 +254,28 @@ Hash funkciók é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 + A függvény elfogadja a mentendő értéket, majd egy algoritmus segítségével kiszámítja a kulcs értékét. + +Dictionary + + A szótár elempárok tárolására szolgál, + melyek közül egyik a kulcs, amely azonosítja az elempárt, + másik az érték, minden kulcs egyedi. + + Gyakorlatilag a szótár úgy viselkedik, + mint egy lista, de az elemek indexe itt tetszőleges típusú lehet pl.: szöveg. + + Konstruktora generikus, paraméter nélküli: + Dictionary(): létrehoz egy szótárt, ahol Tkey a kulcs TValue az érték típusa. + + A szótár elemei a [] operátorral érhetőek el. + A szótárat foreach ciklussal lehet végig olvasni, amellyel a szótárból KeyValuePair + típusú elemeket kapunk. Ezek Key value mezői adják a megfelelő kulcs és érték párokat. + + Fő metódusai: + Add(TKey, TValue) + Bool ContainsKey(TKey) + Bool ContainsValue(TValue) + bool Remove(Tkey) // ha sikeres a művelet akkor true + int Count() + void Clear() szótár ürítése \ No newline at end of file