This commit is contained in:
szabomarton 2024-12-06 11:19:07 +01:00
parent 97d51cdc15
commit affd565abf
20 changed files with 281 additions and 1 deletions

Binary file not shown.

View File

@ -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}"
}
]
}
]
}
]
}

View File

@ -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}"
}
]
}
]
}
]
}

25
20241206/Dict/Dict.sln Normal file
View File

@ -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

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{967317FE-4484-4949-A884-C0A411A637E0}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Dict</RootNamespace>
<AssemblyName>Dict</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -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<int,int> szamokSzama = new Dictionary<int,int>();
for (int i = 0; i < szamok.Length; i++)
{
if (szamokSzama.ContainsKey(szamok[i]))
{
szamokSzama[szamok[i]]++;
} else
{
szamokSzama.Add(szamok[i], 1);
}
}
foreach (KeyValuePair<int, int> item in szamokSzama)
{
Console.WriteLine($"Kulcs: {item.Key}, Érték: {item.Value}");
}
}
}
}

View File

@ -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")]

Binary file not shown.

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

Binary file not shown.

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]

View File

@ -0,0 +1 @@
137ddb1975586287657f37337b64d051167bb6a147915d9fb5b8eb94b1093509

View File

@ -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

Binary file not shown.

Binary file not shown.

View File

@ -255,3 +255,27 @@ Hash funkciók
rögzített számjegyeket, és optimalizálja a tárhelyet. 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 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. 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<TKey, TValue>(): 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<Tkey, Tvalue>
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