diff --git a/AlgorithmLibrary.sln b/AlgorithmLibrary.sln
new file mode 100644
index 0000000000000000000000000000000000000000..df93fcbc41ca71248a24aee89ea53383354ecd56
--- /dev/null
+++ b/AlgorithmLibrary.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.9.34728.123
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AlgorithmLibrary", "AlgorithmLibrary\AlgorithmLibrary.csproj", "{AAF1EDFF-7A07-4838-832B-75F85EA6F45E}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{AAF1EDFF-7A07-4838-832B-75F85EA6F45E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{AAF1EDFF-7A07-4838-832B-75F85EA6F45E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{AAF1EDFF-7A07-4838-832B-75F85EA6F45E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{AAF1EDFF-7A07-4838-832B-75F85EA6F45E}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {3DA52315-0FBD-46A8-B558-8A20105238DA}
+	EndGlobalSection
+EndGlobal
diff --git a/AlgorithmLibrary/AlgorithmLibrary.csproj b/AlgorithmLibrary/AlgorithmLibrary.csproj
new file mode 100644
index 0000000000000000000000000000000000000000..2150e3797ba5eba3218d8435d31f8a8e2cc83c4c
--- /dev/null
+++ b/AlgorithmLibrary/AlgorithmLibrary.csproj
@@ -0,0 +1,10 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>net8.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+</Project>
diff --git a/AlgorithmLibrary/BinarySearch.cs b/AlgorithmLibrary/BinarySearch.cs
new file mode 100644
index 0000000000000000000000000000000000000000..fd6ad2d22b33e877a37bbd6c010ecca9ae1f777f
--- /dev/null
+++ b/AlgorithmLibrary/BinarySearch.cs
@@ -0,0 +1,146 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AlgorithmLibrary
+{
+    internal class BinarySearch
+    {
+        public static int IndexPrvku(int[] A, int k, float div, int? l = null, int? r = null)
+        {
+            if(l == null || r == null)
+            {
+                l = 0;
+                r = A.Length - 1;
+            }
+            return indexPrvku(A, (int)l, (int)r, k, div);
+        }   
+
+        private static int indexPrvku(int[] A, int l, int r, int k, float div)
+        {
+            if (l > r)
+                return -1;
+
+            //int mid = (l + r) / 2;  
+            int interval = r - l;
+            int rozdel = (int)(interval * (1 - div));
+            int divIndex = l + rozdel;
+            if (A[divIndex] == k)
+            {
+                return divIndex;
+            }
+            else if (A[divIndex] < k)
+            {
+                return indexPrvku(A, divIndex + 1, r, k, div);
+            }
+            else
+            {
+                return indexPrvku(A, l, divIndex - 1, k, div);
+            }
+        }
+
+        public static int IndexPrvkuFloat(float[] A, float k, float div, int? l = null, int? r = null)
+        {
+            if (l == null || r == null)
+            {
+                l = 0;
+                r = A.Length - 1;
+            }
+            return indexPrvkuFloat(A, (int)l, (int)r, k, div);
+        }
+
+        private static int indexPrvkuFloat(float[] A, int l, int r, float k, float div)
+        {
+            if (l > r)
+                return -1;
+
+            //int mid = (l + r) / 2;  
+            int interval = r - l;
+            int rozdel = (int)(interval * (1 - div));
+            int divIndex = l + rozdel;
+            if (A[divIndex] == k)
+            {
+                return divIndex;
+            }
+            else if (A[divIndex] < k)
+            {
+                return indexPrvkuFloat(A, divIndex + 1, r, k, div);
+            }
+            else
+            {
+                return indexPrvkuFloat(A, l, divIndex - 1, k, div);
+            }
+        }
+
+
+        public static int IndexPrvkuIterativni(int[] A, int k, float div)
+        {
+            return indexPrvkuIterativni(A, k, A.Length - 1, div);
+        }
+
+        //NEREKURZIVNI !!!!!
+        private static int indexPrvkuIterativni(int[] A, int k, int n, float div)
+        {
+            int l = 0, r = n - 1;
+            while (l <= r)
+            {
+                int interval = r - l;
+                int rozdel = (int)(interval * (1 - div));
+                int divIndex = l + rozdel;
+                if (A[divIndex] == k)
+                {
+                    return divIndex;
+                }
+                else if (A[divIndex] < k)
+                {
+                    l = divIndex + 1;
+                }
+                else
+                {
+                    r = divIndex - 1;
+                }
+            }
+            return -1;
+        }
+
+
+        static public int NejvetsiPrvekNeVetsiNezK(int[] A, int k, int? l = null, int? r = null)
+        {
+            if (l == null || r == null)
+            {
+                l = 0;
+                r = A.Length - 1;
+            }
+            return nejvetsiPrvekNeVetsiNezK(A, (int)l, (int)r, k);
+        }
+
+        //UPRAVENA VARIANTA BEZ PRVKU 
+        static private bool neniVetsiNezK(int[] A, int x, int k)
+        {
+            // neni vetsi nez k, takze je moznym resenim
+            return A[x] <= k;
+        }
+        static private int nejvetsiPrvekNeVetsiNezK(int[] A, int x, int y, int k)
+        {
+            int l = x, r = y;
+            int nejlepsi = -1;
+            while (l <= r)
+            {
+
+                int mid = (l + r) / 2;
+                if (neniVetsiNezK(A, mid, k))
+                {
+                    nejlepsi = mid;
+                    l = mid + 1;
+                }
+                else
+                {
+                    r = mid - 1;
+                }
+            }
+            return nejlepsi;
+        }
+    }
+}
diff --git a/AlgorithmLibrary/MatrixSearch.cs b/AlgorithmLibrary/MatrixSearch.cs
new file mode 100644
index 0000000000000000000000000000000000000000..5d49fafaa1ea6510cf6fc3ffd571f6183a0a94e6
--- /dev/null
+++ b/AlgorithmLibrary/MatrixSearch.cs
@@ -0,0 +1,459 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AlgorithmLibrary
+{
+    internal class MatrixSearch
+    {
+        static private int index1 = -1;
+        static private int index2 = -1;
+        static private int counter = 0;
+        static private int[] indexy = new int[4_000_000];
+
+        private static int indexPrvku(int[] A, int l, int r, int k, float div)
+        {
+            if (l > r)
+                return -1;
+
+            //int mid = (l + r) / 2;  
+            int interval = r - l;
+            int rozdel = (int)(interval * (1 - div));
+            int divIndex = l + rozdel;
+            if (A[divIndex] == k)
+            {
+                return divIndex;
+            }
+            else if (A[divIndex] < k)
+            {
+                return indexPrvku(A, divIndex + 1, r, k, div);
+            }
+            else
+            {
+                return indexPrvku(A, l, divIndex - 1, k, div);
+            }
+        }
+
+        static private bool neniVetsiNezK(int[] A, int x, int k)
+        {
+            // neni vetsi nez k, takze je moznym resenim
+            return A[x] <= k;
+        }
+        static private int nejvetsiPrvekNeVetsiNezK(int[] A, int x, int y, int k)
+        {
+            int l = x, r = y;
+            int nejlepsi = -1;
+            while (l <= r)
+            {
+
+                int mid = (l + r) / 2;
+                if (neniVetsiNezK(A, mid, k))
+                {
+                    nejlepsi = mid;
+                    l = mid + 1;
+                }
+                else
+                {
+                    r = mid - 1;
+                }
+            }
+            return nejlepsi;
+        }
+
+        static public Tuple<int, int> SaddlebackSearch(int[][] A, int k)
+        {
+            index1 = -1;
+            index2 = -1;
+            saddlebackSearch(A, k);
+            return new Tuple<int, int>(index1, index2);
+        }
+
+        static private void saddlebackSearch(int[][] A, int k)
+        {
+            int i = 0;
+            int j = A[0].Length - 1;
+            while (i < A.Length && j >= 0)
+            {
+                if (A[i][j] == k)
+                {
+                    index1 = i;
+                    index2 = j;
+                    return;
+                }
+
+                else if (A[i][j] > k) j--;
+                else i++;
+            }
+            return;
+        }
+
+        static public Tuple<int, int> IndexPrvku2D(int[][] A, int k, float div1, float div2)
+        {
+            index1 = -1;
+            index2 = -1;
+            indexPrvku2D(A, 0, A.Length - 1, 0, A[0].Length - 1, k, div1, div2);
+            return new Tuple<int, int>(index1, index2);
+        }
+
+        static private void indexPrvku2D(int[][] A, int x, int y, int u, int v, int k, float div1, float div2)
+        {
+
+            if (u >= v && x >= y)
+            {
+                if (x == y && u == v && A[x][u] == k)
+                {
+                    index1 = x; index2 = u;
+                }
+                else { return; }
+            }
+
+            int e1 = (int)(x + (y - x) * div1);
+            int e2 = (int)(u + (v - u) * div2);
+
+            bool row = (x == y);
+            bool column = (u == v);
+
+            //podminka 1
+            if (k < A[e1][e2])
+            {
+                indexPrvku2D(A, x, e1, u, e2, k, div1, div2);
+                if (!row) indexPrvku2D(A, e1 + 1, y, u, e2, k, div1, div2);
+                if (!column) indexPrvku2D(A, x, e1, e2 + 1, v, k, div1, div2);
+                return;
+            }
+
+            //podminka 2
+            if (k > A[e1][e2])
+            {
+                indexPrvku2D(A, e1 + 1, y, e2 + 1, v, k, div1, div2);
+                if (!row) indexPrvku2D(A, e1 + 1, y, u, e2, k, div1, div2);
+                if (!column) indexPrvku2D(A, x, e1, e2 + 1, v, k, div1, div2);
+                return;
+            }
+
+            //podminka 3
+            if (k == A[e1][e2])
+            {
+                index1 = e1;
+                index2 = e2;
+                return;
+            }
+
+            return;
+        }
+
+        static public Tuple<int, int>[] IndexyPrvku2D(int[][] A, int k, float div)
+        {
+            indexy = new int[4_000_000];
+            counter = 0;
+            indexyPrvku2D(A, 0, A.Length - 1, 0, A[0].Length - 1, k, div);
+            Tuple<int, int>[] result = new Tuple<int, int>[counter / 2];
+            for (int i = 0; i < counter; i += 2)
+            {
+                result[i / 2] = new Tuple<int, int>(indexy[i], indexy[i + 1]);
+            }
+            return result;
+        }
+
+        static private void indexyPrvku2D(int[][] A, int x, int y, int u, int v, int k, float div)
+        {
+            if (u >= v && x >= y)
+            {
+                if (x == y && u == v && A[x][u] == k)
+                {
+                    indexy[counter++] = x;
+                    indexy[counter++] = u;
+                    return;
+                }
+                else { return; }
+            }
+
+            int e1 = (int)(x + (y - x) * div);
+            int e2 = (int)(u + (v - u) * div);
+
+            bool row = (x == y);
+            bool column = (u == v);
+
+            //podminka 1
+            if (k < A[e1][e2])
+            {
+                indexyPrvku2D(A, x, e1, u, e2, k, div);
+                if (!column) indexyPrvku2D(A, e1 + 1, y, u, e2, k, div);
+                if (!row) indexyPrvku2D(A, x, e1, e2 + 1, v, k, div);
+                return;
+            }
+
+            //podminka 2
+            if (k > A[e1][e2])
+            {
+                indexyPrvku2D(A, e1 + 1, y, e2 + 1, v, k, div);
+                if (!row) indexyPrvku2D(A, e1 + 1, y, u, e2, k, div);
+                if (!column) indexyPrvku2D(A, x, e1, e2 + 1, v, k, div);
+                return;
+            }
+
+            //podminka 3
+            if (k == A[e1][e2])
+            {
+                indexy[counter++] = e1;
+                indexy[counter++] = e2;
+                A[e1][e2] = -1;
+
+                indexyPrvku2D(A, x, e1, u, e2, k, div);
+
+                if (!row)
+                {
+                    indexyPrvku2D(A, e1 + 1, y, u, e2, k, div);
+                }
+
+                if (!column)
+                {
+                    indexyPrvku2D(A, x, e1, e2 + 1, v, k, div);
+                }
+
+                if (!row || !column)
+                {
+                    indexyPrvku2D(A, e1 + 1, y, e2 + 1, v, k, div);
+                }
+                return;
+            }
+            return;
+        }
+
+
+        private static int indexPrvkuSloupec(int[][] A, int column, int x, int y, int k, float div)
+        {
+            if (x > y)
+                return -1;
+
+            //int mid = (l + r) / 2;  
+            int interval = y - x;
+            int rozdel = (int)(interval * (1 - div));
+            int divIndex = x + rozdel;
+            if (A[divIndex][column] == k)
+            {
+                return divIndex;
+            }
+            else if (A[divIndex][column] < k)
+            {
+                return indexPrvkuSloupec(A, column, divIndex + 1, y, k, div);
+            }
+            else
+            {
+                return indexPrvkuSloupec(A, column, x, divIndex - 1, k, div);
+            }
+        }
+        
+        static public Tuple<int, int> BinaryMatice(int[][] A, int k, float div)
+        {
+            index1 = -1;
+            index2 = -1;
+            binaryMatice(A, 0, A.Length - 1, 0, A[0].Length - 1, k, div);
+            return new Tuple<int, int>(index1, index2);
+        }
+
+        static private void binaryMatice(int[][] A, int x, int y, int u, int v, int k, float div)
+        {
+            if (v < u) return;
+            if (index1 != -1 && index2 != -1) return;
+            if (x == -1 || y == -1) return;
+            if (y < x) return;
+            if (u >= v && x >= y)
+            {
+                if (x == y && u == v && A[x][u] == k)
+                {
+                    index1 = x; index2 = u;
+                    return;
+                }
+                else { return; }
+            }
+
+            if (x == y)
+            {
+                index1 = x;
+                index2 = indexPrvku(A[x], u, v, k, div);
+                return;
+            }
+
+            int e1 = (int)(x + (y - x) * div);
+            int e2 = nejvetsiPrvekNeVetsiNezK(A[e1], u, v, k);
+
+            if (e2 == -1)
+            {
+                e2 = u - 1;
+                binaryMatice(A, x, e1 - 1, e2 + 1, v, k, div);
+                return;
+            }
+
+            if (k == A[e1][e2])
+            {
+                index1 = e1;
+                index2 = e2;
+                return;
+            }
+
+            binaryMatice(A, e1 + 1, y, u, e2, k, div);
+            binaryMatice(A, x, e1 - 1, e2 + 1, v, k, div);
+
+            return;
+        }
+
+
+        static private bool neniVetsiNezK2(int[] A, int x, int k)
+        {
+            // neni vetsi nez k, takze je moznym resenim
+            return A[x] < k;
+        }
+        static private int nejvetsiPrvekMensiNezK(int[] A, int x, int y, int k)
+        {
+            int l = x, r = y;
+            int nejlepsi = -1;
+            while (l <= r)
+            {
+
+                int mid = (l + r) / 2;
+                if (neniVetsiNezK2(A, mid, k))
+                {
+                    nejlepsi = mid;
+                    l = mid + 1;
+                }
+                else
+                {
+                    r = mid - 1;
+                }
+            }
+            if (nejlepsi == -1)
+            {
+                nejlepsi = l - 1; // -1 je tu protoze se po vyjiti z funkce pricte 1, takze aby to sedelo;
+            }
+            return nejlepsi;
+
+        }
+
+
+        static private bool neniVetsiNezK_sloupec(int[][] A, int sloupec, int x, int k, bool prvni)
+        {
+            // neni vetsi nez k, takze je moznym resenim
+            if (prvni) return A[x][sloupec] < k;
+            return A[x][sloupec] <= k;
+        }
+        static private int prvniPosledniSloupec(int[][] A, int sloupec, int x, int y, int k, bool prvni)
+        {
+            int l = x, r = y;
+            int nejlepsi = -1;
+            while (l <= r)
+            {
+                int mid = (l + r) / 2;
+                if (neniVetsiNezK_sloupec(A, sloupec, mid, k, prvni))
+                {
+                    nejlepsi = mid;
+                    l = mid + 1;
+                }
+                else
+                {
+                    r = mid - 1;
+                }
+            }
+            if (prvni) return l;
+            return nejlepsi;
+        }
+
+        static private void ulozPozicevyksytu(int[][] A, int x, int y, int L, int R, int row, int k, float div)
+        {
+            for (int i = L; i <= R; i++)
+            {
+                int zacatek = prvniPosledniSloupec(A, i, x, row, k, true);
+                int konec = prvniPosledniSloupec(A, i, row, y, k, false);
+                for (int j = zacatek; j <= konec; j++)
+                {
+                    indexy[counter++] = j;
+                    indexy[counter++] = i;
+                }
+            }
+        }
+
+        static public Tuple<int, int>[] BinaryMatice2(int[][] A, int k, float div)
+        {
+            indexy = new int[4_000_000];
+            counter = 0;
+            binaryMatice2(A, 0, A.Length - 1, 0, A[0].Length - 1, k, div);
+            Tuple<int, int>[] result = new Tuple<int, int>[counter/2];
+            for (int i = 0; i < counter; i += 2)
+            {
+                result[i / 2] = new Tuple<int, int>(indexy[i], indexy[i + 1]);
+            }
+            return result;
+        }
+
+        static private void binaryMatice2(int[][] A, int x, int y, int u, int v, int k, float div/*,bool IsFound*/)
+        {
+            int index_L = -1;
+            int index_R = -1;
+            if (v < u) return;
+            //if (IsFound) return;     ??????
+            //if (index1 != -1 && index2 != -1) return;
+            if (x == -1 || y == -1) return;
+            if (y < x) return;
+
+            if (u >= v && x >= y)
+            {
+                if (x == y && u == v && A[x][u] == k)
+                {
+
+                    indexy[counter++] = x; indexy[counter++] = u;
+                }
+                else { return; }
+
+
+            }
+
+            if (x == y)
+            {
+
+                //int radek = x;
+                index_R = nejvetsiPrvekNeVetsiNezK(A[x], u, v, k);
+                if (index_R != -1)
+                {
+                    if (A[x][index_R] == k)
+                    {
+                        index_L = nejvetsiPrvekMensiNezK(A[x], u, v, k) + 1;
+                        for (int i = index_L; i <= index_R; i++)
+                        {
+                            indexy[counter++] = x; indexy[counter++] = i;
+
+                        }
+                    }
+                }
+                return;
+            }
+
+
+            int e1 = (int)(x + (y - x) * div);
+            int e2 = nejvetsiPrvekNeVetsiNezK(A[e1], u, v, k); //to znamena ze nasel posledni vyksyt prvku - pokud je na konci je treba skontrolavat prvek a pokud je hodnta -1 prvek tam neni
+            int e2_hranice = e2;
+            if (e2 == -1)
+            {
+                e2 = u - 1;
+                binaryMatice2(A, x, e1 - 1, e2 + 1, v, k, div);
+                return;
+            }
+            if (A[e1][e2] == k)
+            {
+                index_R = e2;
+                index_L = nejvetsiPrvekMensiNezK(A[e1], u, v, k) + 1;
+                ulozPozicevyksytu(A, x, y, index_L, index_R, e1, k, div);
+                e2 = index_L - 1;
+            }
+
+
+            binaryMatice2(A, e1 + 1, y, u, e2, k, div/*,IsFound*/);
+            e2 = e2_hranice;
+            binaryMatice2(A, x, e1 - 1, e2 + 1, v, k, div/*,IsFound*/);
+
+            return;
+
+        }
+    }
+}
diff --git a/AlgorithmLibrary/MergeSort.cs b/AlgorithmLibrary/MergeSort.cs
new file mode 100644
index 0000000000000000000000000000000000000000..b2da7b36c767b27cd900c6d079e73a25dbdd45b6
--- /dev/null
+++ b/AlgorithmLibrary/MergeSort.cs
@@ -0,0 +1,84 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AlgorithmLibrary
+{
+    internal class MergeSort
+    {
+
+        public static void Sort(int[] array, float div)
+        {
+            int[] aux = new int[array.Length];
+            mergeSort(array, aux, 0, array.Length - 1, div);
+        }
+
+        /** 
+		 * Razeni slevanim (od nejvyssiho)
+		 * @param array pole k serazeni
+		 * @param aux pomocne pole stejne delky jako array
+		 * @param left prvni index na ktery se smi sahnout
+		 * @param right posledni index, na ktery se smi sahnout
+		 */
+        public static void mergeSort(int[] array, int[] aux, int left, int right, float div)
+        {
+            if (left >= right) return;
+            int rozdil = right - left;
+
+            int divIndex = left + (int)(rozdil * (1 - div)); // Rozdeleni pole parametrem div
+                                                             // (koresponduje s koeficientem b rekurentni rovnice)
+          
+
+            mergeSort(array, aux, left, divIndex, div);
+            mergeSort(array, aux, divIndex + 1, right, div);
+            Merge(array, aux, left, right, div);
+
+            for (int i = left; i <= right; i++)
+            {
+                array[i] = aux[i];
+            }
+        }
+
+        /**
+         * Slevani pro Merge sort 
+         * @param array pole k serazeni
+         * @param aux pomocne pole (stejne velikosti jako razene)
+         * @param left prvni index, na ktery smim sahnout
+         * @param right posledni index, na ktery smim sahnout
+         */
+        private static void Merge(int[] array, int[] aux, int left, int right, float div)
+        {
+            int rozdil = right - left;
+            int divIndex = (int)(rozdil * (1 - div));
+
+
+            int leftIndex = left;
+            int rightIndex = left + divIndex + 1;
+            int auxIndex = left;
+            while (leftIndex <= left + divIndex && rightIndex <= right)
+            {
+                if (array[leftIndex] <= array[rightIndex])
+                {
+                    aux[auxIndex] = array[leftIndex++];
+                }
+                else
+                {
+                    aux[auxIndex] = array[rightIndex++];
+                }
+                auxIndex++;
+            }
+            while (leftIndex <= left + divIndex)
+            {
+                aux[auxIndex] = array[leftIndex++];
+                auxIndex++;
+            }
+            while (rightIndex <= right)
+            {
+                aux[auxIndex] = array[rightIndex++];
+                auxIndex++;
+            }
+        }
+    }
+}
diff --git a/AlgorithmLibrary/Program.cs b/AlgorithmLibrary/Program.cs
new file mode 100644
index 0000000000000000000000000000000000000000..2e62bb30b2ed803f76e1d9bf979437317d552877
--- /dev/null
+++ b/AlgorithmLibrary/Program.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Numerics;
+
+namespace AlgorithmLibrary
+{
+    internal class Program
+    {
+        static void Main(string[] args)
+        {
+            int[] array = { 5, 2, 9, 1, 5, 6 };
+
+            float div = 0.99f;
+
+            Console.WriteLine("\nMERGESORT:\n");
+            Console.WriteLine("Před: " + string.Join(", ", array));
+            MergeSort.Sort(array, div);
+            Console.WriteLine("Po: " + string.Join(", ", array));
+            Console.WriteLine("\n----------------------");
+            Console.WriteLine("\nBINÁRNÍ VYHLEDÁVÁNÍ\n");
+            Console.WriteLine("HledanĂ˝ prvek: 6");
+            Console.WriteLine("indexPrvku: " + BinarySearch.IndexPrvku(array, 6, div));
+            Console.WriteLine("indexPrvku2: " + BinarySearch.IndexPrvkuIterativni(array, 6, div));
+            Console.WriteLine("indexPrvkuFloat: " + BinarySearch.IndexPrvkuFloat(new float[] { 1.0f, 2.0f, 5.0f, 5.0f, 6.0f, 9.0f }, 6.0f, div));
+            Console.WriteLine("nejvetsiPrvekNeVetsiNezK: " + BinarySearch.NejvetsiPrvekNeVetsiNezK(array, 6));
+
+            Console.WriteLine("\n----------------------");
+            Console.WriteLine("\nMATICOVÉ VYHLEDÁVÁNÍ\n");
+            int[][] matrix = Utils.GenerateRandomMatrix(5, 5, 10);
+            int[][] matrix1 = Utils.CopyMatrix(matrix);
+            int[][] matrix2 = Utils.CopyMatrix(matrix);
+            int[][] matrix3 = Utils.CopyMatrix(matrix);
+
+            Console.WriteLine("Matice:");
+            Utils.PrintMatrix(matrix);
+
+            int k = matrix[1][4];
+            float div1 = 0.5f;
+            float div2 = 0.5f;
+            Console.WriteLine("HledanĂ˝ prvek: " + k);
+            Console.WriteLine();
+
+            Tuple<int, int> result = MatrixSearch.SaddlebackSearch(matrix, k);
+            Console.WriteLine($"Saddleback: ({result.Item1}, {result.Item2})");
+
+            result = MatrixSearch.IndexPrvku2D(matrix, k, div1, div2);
+            Console.WriteLine($"IndexPrvku2D: ({result.Item1}, {result.Item2})");
+
+            Tuple<int, int>[] results = MatrixSearch.IndexyPrvku2D(matrix1, k, div1);
+            Console.WriteLine("IndexyPrvku2D:");
+            foreach (var res in results)
+            {
+                Console.WriteLine($"({res.Item1}, {res.Item2})");
+            }
+
+            result = MatrixSearch.BinaryMatice(matrix2, k, div1);
+            Console.WriteLine($"BinaryMatice: ({result.Item1}, {result.Item2})");
+
+            results = MatrixSearch.BinaryMatice2(matrix3, k, div1);
+            Console.WriteLine("BinaryMatice2:");
+            foreach (var res in results)
+            {
+                Console.WriteLine($"({res.Item1}, {res.Item2})");
+            }
+
+        }
+    }
+}
\ No newline at end of file
diff --git a/AlgorithmLibrary/Utils.cs b/AlgorithmLibrary/Utils.cs
new file mode 100644
index 0000000000000000000000000000000000000000..74eb22e8dc83883f40aef722ad75df3aa64028c2
--- /dev/null
+++ b/AlgorithmLibrary/Utils.cs
@@ -0,0 +1,214 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AlgorithmLibrary
+{
+    internal class Utils
+    {
+        private static string RunScript(int n, int m, int max_int_val)
+        {
+            ProcessStartInfo start = new ProcessStartInfo();
+            string scriptPath = "..\\..\\..\\matrix_generator.py";
+            start.FileName = "python";
+            start.Arguments = $"\"{scriptPath}\" {n} {m} {max_int_val}";
+            start.UseShellExecute = false;
+            start.RedirectStandardOutput = true;
+            start.RedirectStandardError = true;
+            start.CreateNoWindow = true;
+
+            string error = "";
+
+            using (Process process = Process.Start(start))
+            {
+                if (process != null)
+                {
+                    using (System.IO.StreamReader reader = process.StandardError)
+                    {
+                        error = reader.ReadToEnd();
+                    }
+                    process.WaitForExit();
+                    if (!string.IsNullOrEmpty(error))
+                    {
+                        throw new Exception($"Python script error: {error}");
+                    }
+                }
+                else
+                {
+                    throw new Exception("Could not start Python process.");
+                }
+            }
+            return "Ok";
+        }
+
+        private static int[][] LoadMatrixFromFile(int n, int m)
+        {
+            string filename = $"{n}x{m}.txt";
+            string filePath = Path.Combine(Directory.GetCurrentDirectory(), filename); // Assuming the file is in the same directory
+
+            if (!File.Exists(filePath))
+            {
+                Console.WriteLine($"Error: File '{filename}' not found in '{Directory.GetCurrentDirectory()}'.");
+                return null;
+            }
+
+            try
+            {
+                string[] lines = File.ReadAllLines(filePath);
+
+                int[][] matrix = new int[n][];
+
+                for (int i = 0; i < n; i++)
+                {
+                    string[] numbers = lines[i].Split(new char[] { ' ', '\t', ',' }, StringSplitOptions.RemoveEmptyEntries);
+                    if (numbers.Length != m)
+                    {
+                        Console.WriteLine($"Error: Expected {n} numbers in row {i + 1} of '{filename}', but found {numbers.Length}.");
+                        return null;
+                    }
+
+                    matrix[i] = numbers.Select(int.Parse).ToArray();
+                }
+
+                return matrix;
+            }
+            catch (FileNotFoundException)
+            {
+                Console.WriteLine($"Error: File '{filename}' not found.");
+                return null;
+            }
+            catch (Exception ex)
+            {
+                Console.WriteLine($"An unexpected error occurred: {ex.Message}");
+                return null;
+            }
+        }
+
+        private static void removeFile(int n, int m)
+        {
+            string filename = $"{n}x{m}.txt";
+            string filePath = Path.Combine(Directory.GetCurrentDirectory(), filename);
+            if (File.Exists(filePath))
+            {
+                File.Delete(filePath);
+            }   
+        }
+
+        public static int[][] GenerateRandomMatrixUsingPython(int n, int m, int max_int_value)
+        {
+            RunScript(n, m, max_int_value);
+            int[][] matrix = LoadMatrixFromFile(n, m);
+            removeFile(n, m);
+            return matrix;
+        }
+
+        public static int[][] GenerateRandomMatrix(int a, int b, int max_int_value)
+        {
+            int[][] matrix = new int[a][];
+            for (int k = 0; k < a; k++)
+            {
+                matrix[k] = new int[b];
+            }
+
+            Random random = new Random();
+
+            for (int i = 0; i < a; i++)
+            {
+                for (int j = 0; j < b; j++)
+                {
+                    matrix[i][j] = random.Next(0, max_int_value);
+                }
+            }
+
+            for (int i = 0; i < a; i++)
+            {
+                SortRow(matrix, i);
+            }
+
+
+            for (int j = 0; j < b; j++)
+            {
+                SortColumn(matrix, j);
+            }
+
+            return matrix;
+        }
+
+        //SETRIDENI RADKU - BUBBLE SORT
+        private static void SortRow(int[][] matrix, int row)
+        {
+            int n = matrix[0].Length;
+            for (int i = 0; i < n - 1; i++)
+            {
+                for (int j = 0; j < n - i - 1; j++)
+                {
+                    if (matrix[row][j] > matrix[row][j + 1])
+                    {
+                        int temp = matrix[row][j];
+                        matrix[row][j] = matrix[row][j + 1];
+                        matrix[row][j + 1] = temp;
+                    }
+                }
+            }
+        }
+
+        //SETRIDENI SLOUPCU - BUBBLE SORT
+        private static void SortColumn(int[][] matrix, int col)
+        {
+            int n = matrix.Length;
+            for (int i = 0; i < n - 1; i++)
+            {
+                for (int j = 0; j < n - i - 1; j++)
+                {
+                    if (matrix[j][col] > matrix[j + 1][col])
+                    {
+                        int temp = matrix[j][col];
+                        matrix[j][col] = matrix[j + 1][col];
+                        matrix[j + 1][col] = temp;
+                    }
+                }
+            }
+        }
+
+        //TISK MATICE
+        public static void PrintMatrix(int[][] matrix)
+        {
+            if (matrix == null)
+            {
+                Console.WriteLine("Matrix is null.");
+                return;
+            }
+
+            int rows = matrix.Length;
+            int cols = matrix[0].Length;
+
+            for (int i = 0; i < rows; i++)
+            {
+                for (int j = 0; j < cols; j++)
+                {
+                    Console.Write(matrix[i][j] + "\t");
+                }
+                Console.WriteLine();
+            }
+        }
+
+        public static int[][] CopyMatrix(int[][] matrix)
+        { 
+            int cols = matrix[0].Length;
+            int rows = matrix.Length;
+            int[][] copy = new int[rows][];
+            for (int i = 0; i < rows; i++)
+            {
+                copy[i] = new int[cols];
+                for (int j = 0; j < cols; j++)
+                {
+                    copy[i][j] = matrix[i][j];
+                }
+            }
+            return copy;
+        }
+    }
+}
diff --git a/AlgorithmLibrary/matrix_generator.py b/AlgorithmLibrary/matrix_generator.py
new file mode 100644
index 0000000000000000000000000000000000000000..472d581359227035556fc5df585638539fceb08b
--- /dev/null
+++ b/AlgorithmLibrary/matrix_generator.py
@@ -0,0 +1,19 @@
+import numpy as np
+import sys
+
+def sort_matrix(matrix):
+    matrix = np.sort(matrix, axis=1)
+    matrix = np.sort(matrix, axis=0)
+    return matrix
+
+def generate_and_save_matrices(n, m):
+    file_name = f"{n}x{m}.txt"
+    with open(file_name, "w") as f:
+        #matrix = 2 * np.random.randint(0, max_int // 2, size=(n, m), dtype=np.int32)
+        matrix = np.random.randint(0, max_int, size=(n, m), dtype=np.int32)
+        sorted_matrix = sort_matrix(matrix)
+        np.savetxt(f, sorted_matrix, fmt='%d')
+        f.write("\n")
+
+max_int = int(sys.argv[3])
+generate_and_save_matrices(n=int(sys.argv[1]), m=int(sys.argv[2]))
diff --git a/README.md b/README.md
index 94f4a7438d0d558fca899583b8994347ec33a055..425caf27f19be9b57bbfa4d6b156c00edbf61001 100644
--- a/README.md
+++ b/README.md
@@ -1,93 +1 @@
-# AlgorithmLibrary
-
-
-
-## Getting started
-
-To make it easy for you to get started with GitLab, here's a list of recommended next steps.
-
-Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
-
-## Add your files
-
-- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
-- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
-
-```
-cd existing_repo
-git remote add origin https://gitlab.vsb.cz/klara.nieslanikova.st/algorithmlibrary.git
-git branch -M main
-git push -uf origin main
-```
-
-## Integrate with your tools
-
-- [ ] [Set up project integrations](https://gitlab.vsb.cz/klara.nieslanikova.st/algorithmlibrary/-/settings/integrations)
-
-## Collaborate with your team
-
-- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
-- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
-- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
-- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
-- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
-
-## Test and Deploy
-
-Use the built-in continuous integration in GitLab.
-
-- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
-- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
-- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
-- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
-- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
-
-***
-
-# Editing this README
-
-When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
-
-## Suggestions for a good README
-
-Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
-
-## Name
-Choose a self-explaining name for your project.
-
-## Description
-Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
-
-## Badges
-On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
-
-## Visuals
-Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
-
-## Installation
-Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
-
-## Usage
-Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
-
-## Support
-Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
-
-## Roadmap
-If you have ideas for releases in the future, it is a good idea to list them in the README.
-
-## Contributing
-State if you are open to contributions and what your requirements are for accepting them.
-
-For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
-
-You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
-
-## Authors and acknowledgment
-Show your appreciation to those who have contributed to the project.
-
-## License
-For open source projects, say how it is licensed.
-
-## Project status
-If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
+Knihovna algoritmĹŻ