diff --git a/20250109/C#.pptx b/20250109/C#.pptx new file mode 100644 index 0000000..bc1e663 Binary files /dev/null and b/20250109/C#.pptx differ diff --git a/20250109/ConsoleApp1/.vs/ConsoleApp1/FileContentIndex/9cd64189-055f-4c69-b32c-9fe42b027924.vsidx b/20250109/ConsoleApp1/.vs/ConsoleApp1/FileContentIndex/9cd64189-055f-4c69-b32c-9fe42b027924.vsidx new file mode 100644 index 0000000..b1573c6 Binary files /dev/null and b/20250109/ConsoleApp1/.vs/ConsoleApp1/FileContentIndex/9cd64189-055f-4c69-b32c-9fe42b027924.vsidx differ diff --git a/20250109/ConsoleApp1/.vs/ConsoleApp1/v17/.suo b/20250109/ConsoleApp1/.vs/ConsoleApp1/v17/.suo new file mode 100644 index 0000000..333f530 Binary files /dev/null and b/20250109/ConsoleApp1/.vs/ConsoleApp1/v17/.suo differ diff --git a/20250109/ConsoleApp1/.vs/ConsoleApp1/v17/DocumentLayout.backup.json b/20250109/ConsoleApp1/.vs/ConsoleApp1/v17/DocumentLayout.backup.json new file mode 100644 index 0000000..ba4f3dd --- /dev/null +++ b/20250109/ConsoleApp1/.vs/ConsoleApp1/v17/DocumentLayout.backup.json @@ -0,0 +1,37 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20250109\\ConsoleApp1\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{384B95C5-77D4-4CC8-86E2-D39132973D06}|ConsoleApp1\\ConsoleApp1.csproj|c:\\users\\szabomarton\\desktop\\c#\\progaora\\20250109\\consoleapp1\\consoleapp1\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{384B95C5-77D4-4CC8-86E2-D39132973D06}|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\\20250109\\ConsoleApp1\\ConsoleApp1\\Program.cs", + "RelativeDocumentMoniker": "ConsoleApp1\\Program.cs", + "ToolTip": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20250109\\ConsoleApp1\\ConsoleApp1\\Program.cs", + "RelativeToolTip": "ConsoleApp1\\Program.cs", + "ViewState": "AgIAAD8AAAAAAAAAAAAqwFcAAAAiAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-01-09T07:16:29.377Z", + "EditorCaption": "" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/20250109/ConsoleApp1/.vs/ConsoleApp1/v17/DocumentLayout.json b/20250109/ConsoleApp1/.vs/ConsoleApp1/v17/DocumentLayout.json new file mode 100644 index 0000000..7c67466 --- /dev/null +++ b/20250109/ConsoleApp1/.vs/ConsoleApp1/v17/DocumentLayout.json @@ -0,0 +1,37 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20250109\\ConsoleApp1\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{384B95C5-77D4-4CC8-86E2-D39132973D06}|ConsoleApp1\\ConsoleApp1.csproj|c:\\users\\szabomarton\\desktop\\c#\\progaora\\20250109\\consoleapp1\\consoleapp1\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{384B95C5-77D4-4CC8-86E2-D39132973D06}|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\\20250109\\ConsoleApp1\\ConsoleApp1\\Program.cs", + "RelativeDocumentMoniker": "ConsoleApp1\\Program.cs", + "ToolTip": "C:\\Users\\szabomarton\\Desktop\\C#\\ProgaOra\\20250109\\ConsoleApp1\\ConsoleApp1\\Program.cs", + "RelativeToolTip": "ConsoleApp1\\Program.cs", + "ViewState": "AgIAAD8AAAAAAAAAAAAQwEgAAAAvAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-01-09T07:16:29.377Z", + "EditorCaption": "" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/20250109/ConsoleApp1/ConsoleApp1.sln b/20250109/ConsoleApp1/ConsoleApp1.sln new file mode 100644 index 0000000..e7ccdf3 --- /dev/null +++ b/20250109/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", "{384B95C5-77D4-4CC8-86E2-D39132973D06}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {384B95C5-77D4-4CC8-86E2-D39132973D06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {384B95C5-77D4-4CC8-86E2-D39132973D06}.Debug|Any CPU.Build.0 = Debug|Any CPU + {384B95C5-77D4-4CC8-86E2-D39132973D06}.Release|Any CPU.ActiveCfg = Release|Any CPU + {384B95C5-77D4-4CC8-86E2-D39132973D06}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {DD6E9B96-D2BD-4E54-B4FC-B63016DC2BE5} + EndGlobalSection +EndGlobal diff --git a/20250109/ConsoleApp1/ConsoleApp1/App.config b/20250109/ConsoleApp1/ConsoleApp1/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/20250109/ConsoleApp1/ConsoleApp1/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/20250109/ConsoleApp1/ConsoleApp1/ConsoleApp1.csproj b/20250109/ConsoleApp1/ConsoleApp1/ConsoleApp1.csproj new file mode 100644 index 0000000..9c1844a --- /dev/null +++ b/20250109/ConsoleApp1/ConsoleApp1/ConsoleApp1.csproj @@ -0,0 +1,53 @@ + + + + + Debug + AnyCPU + {384B95C5-77D4-4CC8-86E2-D39132973D06} + 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/20250109/ConsoleApp1/ConsoleApp1/Program.cs b/20250109/ConsoleApp1/ConsoleApp1/Program.cs new file mode 100644 index 0000000..587099e --- /dev/null +++ b/20250109/ConsoleApp1/ConsoleApp1/Program.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp1 +{ + internal class Program + { + static void TombKiir(int[] tomb) + { + foreach (int i in tomb) + { + Console.Write($"{i}, "); + } + Console.WriteLine(); + } + + public static void Gyorsrendez(int[] tomb, int eleje, int vege) + { + if (eleje < vege) { + int kozepe = Feloszt(tomb, eleje, vege); + Gyorsrendez(tomb, eleje, kozepe - 1); + Gyorsrendez(tomb, kozepe + 1, vege); + } + } + + public static int Feloszt(int[] tomb, int eleje, int vege) + { + int kozepe = tomb[vege]; + int kozepindex = eleje; + + for (int i = eleje; i < vege; i++) + { + if (tomb[i] <= kozepe) + { + int temp = tomb[i]; + tomb[i] = tomb[kozepindex]; + tomb[kozepindex] = temp; + kozepindex++; + } + } + + int kozepindexErteke = tomb[kozepindex]; + tomb[kozepindex] = tomb[vege]; + tomb[vege] = kozepindexErteke; + return kozepindex; + } + + public static Int64 Faktorialis(Int64 szam) + { + if (szam == 1) + { + return 1; + } + + return szam * Faktorialis(szam - 1); + } + + public static Int64 Fib(Int64 num) + { + if (num == 1) + { + return 1; + } + + if (num == 0) + { + return 0; + } + + return Fib(num - 1) + Fib(num - 2); + } + + static void Main(string[] args) + { + /* + var tomb = new int[] { 9, 6, 0, 0, 1, 2, 2, 2, 3, 1, 5, 4, 8, 2, 8, 6 }; + + Console.WriteLine("Rendezés előtt: "); + TombKiir(tomb); + + Console.WriteLine("Gyors rendezés: "); + Gyorsrendez(tomb, 0, tomb.Length - 1); + TombKiir(tomb); + */ + + for (int i = 1; i < 20; i++) + { + //Console.WriteLine($"{i}. faktoriális {Faktorialis(i)}"); + Console.WriteLine($"{i}. fibonacci: {Fib(i)} "); + } + + + Console.ReadLine(); + } + } +} diff --git a/20250109/ConsoleApp1/ConsoleApp1/Properties/AssemblyInfo.cs b/20250109/ConsoleApp1/ConsoleApp1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d8e1a7d --- /dev/null +++ b/20250109/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 © 2025")] +[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("384b95c5-77d4-4cc8-86e2-d39132973d06")] + +// 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/20250109/ConsoleApp1/ConsoleApp1/bin/Debug/ConsoleApp1.exe b/20250109/ConsoleApp1/ConsoleApp1/bin/Debug/ConsoleApp1.exe new file mode 100644 index 0000000..ad3c7c7 Binary files /dev/null and b/20250109/ConsoleApp1/ConsoleApp1/bin/Debug/ConsoleApp1.exe differ diff --git a/20250109/ConsoleApp1/ConsoleApp1/bin/Debug/ConsoleApp1.exe.config b/20250109/ConsoleApp1/ConsoleApp1/bin/Debug/ConsoleApp1.exe.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/20250109/ConsoleApp1/ConsoleApp1/bin/Debug/ConsoleApp1.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/20250109/ConsoleApp1/ConsoleApp1/bin/Debug/ConsoleApp1.pdb b/20250109/ConsoleApp1/ConsoleApp1/bin/Debug/ConsoleApp1.pdb new file mode 100644 index 0000000..5353b58 Binary files /dev/null and b/20250109/ConsoleApp1/ConsoleApp1/bin/Debug/ConsoleApp1.pdb differ diff --git a/20250109/ConsoleApp1/ConsoleApp1/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs b/20250109/ConsoleApp1/ConsoleApp1/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs new file mode 100644 index 0000000..3871b18 --- /dev/null +++ b/20250109/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/20250109/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.AssemblyReference.cache b/20250109/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.AssemblyReference.cache new file mode 100644 index 0000000..126ed02 Binary files /dev/null and b/20250109/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.AssemblyReference.cache differ diff --git a/20250109/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.CoreCompileInputs.cache b/20250109/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..0be8d26 --- /dev/null +++ b/20250109/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +137ddb1975586287657f37337b64d051167bb6a147915d9fb5b8eb94b1093509 diff --git a/20250109/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.FileListAbsolute.txt b/20250109/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..58d080a --- /dev/null +++ b/20250109/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.csproj.FileListAbsolute.txt @@ -0,0 +1,7 @@ +C:\Users\szabomarton\Desktop\C#\ProgaOra\20250109\ConsoleApp1\ConsoleApp1\bin\Debug\ConsoleApp1.exe.config +C:\Users\szabomarton\Desktop\C#\ProgaOra\20250109\ConsoleApp1\ConsoleApp1\bin\Debug\ConsoleApp1.exe +C:\Users\szabomarton\Desktop\C#\ProgaOra\20250109\ConsoleApp1\ConsoleApp1\bin\Debug\ConsoleApp1.pdb +C:\Users\szabomarton\Desktop\C#\ProgaOra\20250109\ConsoleApp1\ConsoleApp1\obj\Debug\ConsoleApp1.csproj.AssemblyReference.cache +C:\Users\szabomarton\Desktop\C#\ProgaOra\20250109\ConsoleApp1\ConsoleApp1\obj\Debug\ConsoleApp1.csproj.CoreCompileInputs.cache +C:\Users\szabomarton\Desktop\C#\ProgaOra\20250109\ConsoleApp1\ConsoleApp1\obj\Debug\ConsoleApp1.exe +C:\Users\szabomarton\Desktop\C#\ProgaOra\20250109\ConsoleApp1\ConsoleApp1\obj\Debug\ConsoleApp1.pdb diff --git a/20250109/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.exe b/20250109/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.exe new file mode 100644 index 0000000..ad3c7c7 Binary files /dev/null and b/20250109/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.exe differ diff --git a/20250109/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.pdb b/20250109/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.pdb new file mode 100644 index 0000000..5353b58 Binary files /dev/null and b/20250109/ConsoleApp1/ConsoleApp1/obj/Debug/ConsoleApp1.pdb differ diff --git a/20250109/ConsoleApp1/ConsoleApp1/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/20250109/ConsoleApp1/ConsoleApp1/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..2c2cab9 Binary files /dev/null and b/20250109/ConsoleApp1/ConsoleApp1/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/20250109/Gyorsrend.pdf b/20250109/Gyorsrend.pdf new file mode 100644 index 0000000..513c29a Binary files /dev/null and b/20250109/Gyorsrend.pdf differ diff --git a/adatstrukturak b/adatstrukturak index 151658d..23d2308 100644 --- a/adatstrukturak +++ b/adatstrukturak @@ -380,4 +380,41 @@ Beszúrásos rendezés Továbbá akkor igen hatékony, ha egy rendezett sorozatot bővítünk és a bővítés után is szeretnénk, hogy a sorozat rendezett maradjon. - Az algoritmus futási ideje legjobb esetben konstans, legrosszabb esetben négyzetes. \ No newline at end of file + Az algoritmus futási ideje legjobb esetben konstans, legrosszabb esetben négyzetes. + +Gyors rendezés + A gyorsrendezés az "oszd meg és uralkodj" elven működik. + Lépései a következők: + 1. Kiválasztunk a tömbből egy tetszőleges elemet. + Ez lesz az ún. vezérelem (pivot). + 2. Az ennél kisebbeket a tömb elejére, az ennél nagyobbakat a tömb végére rendezzük. + A vezérelemmel megegyező .... + + Az algoritmus Hatékonysága azon múlik, hogy sikerül-e jó vezérelemet választani. + Az algoritmus O(n log n) időben tud teljesíteni, de legrosszabb esetben O(n2) időben fut le. + + QUICKSORT (kez=0, vég=6) + + i = kez + j = veg + pivot = a[(i+j)/2] + Amíg i <= j + Amíg a[i] < pivot + i növelése + Amíg a[j] > pivot + j csökkentése + Ha i <= j Akkor + csere a[i] a[j] + i növelése + j csökkentése + Ha kez < j Akkor + QUICKSORT() + +Rekurzió + +Fibonacci sorozat + a n = (a n-1) + (a n-2) + + Iteratív számítás + +