diff --git a/ALGA/03_Tomb.cs b/ALGA/03_Tomb.cs deleted file mode 100644 index 8173515..0000000 --- a/ALGA/03_Tomb.cs +++ /dev/null @@ -1,274 +0,0 @@ -// using System; -// using System.Collections; -// using System.Collections.Generic; - -// namespace OE.ALGA.Adatszerkezetek -// { -// public class TombVerem : Verem -// { -// T[] tomb; -// int n = 0; -// public TombVerem(int l) -// { -// tomb = new T[l]; -// } -// public bool Ures -// { -// get { return n == 0; } -// } - -// public T Felso() -// { -// return tomb[n - 1]; -// } - -// public void Verembe(T ertek) -// { -// if (n < tomb.Length) -// { -// tomb[n] = ertek; -// n++; -// } -// else -// { -// throw new NincsHelyKivetel(); -// } -// } - -// public T Verembol() -// { -// if (Ures) -// { -// throw new NincsElemKivetel(); -// } -// else -// { -// T ertek = tomb[n - 1]; -// n--; -// return ertek; -// } - -// } -// } -// public class TombSor : Sor -// { -// T[] tomb; -// int n = 0; -// public TombSor(int l) -// { -// tomb = new T[l]; -// } - -// public bool Ures -// { -// get { return n == 0; } -// } - -// public T Elso() -// { -// return tomb[0]; -// } - -// public void Sorba(T ertek) -// { -// if (n < tomb.Length) -// { -// tomb[n] = ertek; -// n++; -// } -// else -// { -// throw new NincsHelyKivetel(); -// } -// } - -// public T Sorbol() -// { -// if (Ures) -// { -// throw new NincsElemKivetel(); -// } -// else -// { -// T ertek = tomb[0]; -// T[] tmp = new T[tomb.Length]; -// n--; -// for (int i = 1; i < tomb.Length; i++) -// { -// tmp[i - 1] = tomb[i]; -// } -// tomb = tmp; -// return ertek; -// } -// } -// } -// public class TombLista : Lista, IEnumerable -// { -// T[] tomb; -// int n = 0; - -// public bool Ures -// { -// get { return n <= 0; } -// } -// public TombLista() -// { -// tomb = new T[1]; -// } - -// public int Elemszam -// { -// get { return n; } -// } - -// public void Bejar(Action muvelet) -// { -// for (int i = 0; i < n; i++) -// { -// muvelet?.Invoke(tomb[i]); -// } -// } - -// public void Beszur(int index, T ertek) -// { -// if (index < 0) -// { -// throw new HibasIndexKivetel(); -// } -// else -// { -// T[] tmp = new T[tomb.Length * 2]; -// for (int i = 0; i < index; i++) -// { -// tmp[i] = tomb[i]; -// } -// tmp[index] = ertek; -// for (int i = index + 1; i < tomb.Length; i++) -// { -// tmp[i] = tomb[i - 1]; -// } -// tomb = tmp; -// n++; -// } -// } - -// public IEnumerator GetEnumerator() -// { -// foreach (T t in tomb) -// { -// if (t != null) -// { -// yield return t; -// } -// } -// } - -// public void Hozzafuz(T ertek) -// { -// if (n < tomb.Length) -// { -// tomb[n] = ertek; -// n++; -// } -// else -// { -// T[] tmp = new T[tomb.Length * 2]; -// for (int i = 0; i < tomb.Length; i++) -// { -// tmp[i] = tomb[i]; -// } -// tmp[n] = ertek; -// tomb = tmp; -// n++; -// } -// } - -// public T Kiolvas(int index) -// { -// if (index < 0 || index >= tomb.Length) -// { -// throw new HibasIndexKivetel(); -// } -// return tomb[index]; -// } - -// public void Modosit(int index, T ertek) -// { -// if (index < 0 && index < tomb.Length) -// { -// throw new HibasIndexKivetel(); -// } -// else -// { -// tomb[index] = ertek; -// } -// } - -// public void Torol(T ertek) -// { -// int m = n; -// T[] tmp = new T[tomb.Length]; -// int index = 0; -// for (int i = 0; i < m; i++) -// { -// if (ertek.Equals(tomb[i])) -// { -// n--; -// continue; -// } -// tmp[index] = tomb[i]; -// index++; -// } -// tomb = tmp; -// } - -// IEnumerator IEnumerable.GetEnumerator() -// { -// TombListaBejaro bejaro = new TombListaBejaro(tomb, n); -// return bejaro; -// } -// } -// public class TombListaBejaro : IEnumerator -// { -// T[] e; -// int n; -// int aktualisindex; -// T current; -// public T Current -// { -// get { return current; } -// } -// public TombListaBejaro(T[] e, int n) -// { -// this.n = n; -// this.e = e; -// aktualisindex = 0; -// current = e[0]; -// } - -// object IEnumerator.Current => Current; - -// public void Dispose() -// { -// throw new NotImplementedException(); -// } - -// public bool MoveNext() -// { -// if (aktualisindex < n - 1) -// { -// aktualisindex++; -// return true; -// } -// else -// { -// return false; -// } -// } - -// public void Reset() -// { -// aktualisindex = -1; -// } -// } -// } \ No newline at end of file diff --git a/ALGA/04_EgyszeruLanc.cs b/ALGA/04_EgyszeruLanc.cs deleted file mode 100644 index 4b7dc88..0000000 --- a/ALGA/04_EgyszeruLanc.cs +++ /dev/null @@ -1,325 +0,0 @@ -// using System; -// using System.Collections; -// using System.Collections.Generic; -// using System.Runtime.CompilerServices; - -// namespace OE.ALGA.Adatszerkezetek; - -// public class LancElem -// { -// public T tart; -// public LancElem? kov; -// public LancElem? elozo; - -// public LancElem(T tart, LancElem? kov, LancElem? elozo) -// { -// this.tart = tart; -// this.kov = kov; -// this.elozo = elozo; -// } -// } -// public class LancoltVerem : Verem -// { -// LancElem? fej; -// LancElem? teteje; -// public LancoltVerem() -// { -// } -// public void Felszabadit() -// { - -// } -// public bool Ures -// { -// get { return fej == null; } -// } - -// public T Felso() -// { -// if (Ures) -// { -// throw new NincsElemKivetel(); -// } -// else -// { -// LancElem? tmp = fej; -// while (tmp.kov != null) -// { -// tmp = tmp.kov; -// } -// teteje = tmp; -// return tmp.tart; -// } -// } - -// public void Verembe(T ertek) -// { -// if (Ures) -// { -// fej = new LancElem(ertek, null, null); -// teteje = fej; -// } -// else -// { -// teteje.kov = new LancElem(ertek, null, teteje); -// teteje = teteje.kov; -// } -// } - -// public T Verembol() -// { -// if (Ures) -// { -// throw new NincsElemKivetel(); -// } -// else -// { -// if (teteje.elozo == null) -// { -// T ertek = fej.tart; -// fej = null; -// teteje = fej; -// return ertek; -// } -// else -// { -// T ertek = Felso(); -// teteje.elozo.kov = null; -// teteje = teteje.elozo; -// return ertek; -// } -// } -// } -// } -// public class LancoltSor : Sor -// { -// LancElem? fej; -// LancElem? vege; -// public bool Ures -// { -// get { return ( vege == null); } -// } -// public LancoltSor() -// { - -// } -// public void Felszabadit() -// { - -// } -// public T Elso() -// { -// return fej.tart; -// } - -// public void Sorba(T ertek) -// { -// if (Ures) -// { -// fej = new LancElem(ertek, null, null); -// vege = fej; -// } -// else -// { -// LancElem? tmp = fej; -// while (tmp.kov != null) -// { -// tmp = tmp.kov; -// } -// tmp.kov = new LancElem(ertek, null, tmp); -// vege = tmp.kov; -// } -// } - -// public T Sorbol() -// { -// if (Ures) -// { -// throw new NincsElemKivetel(); -// } -// else -// { -// if (vege.elozo == null) -// { -// T ertek = vege.tart; -// vege = null; -// return ertek; -// } -// else -// { -// T ertek = fej.tart; -// fej = fej.kov; -// fej.elozo = null; -// return ertek; -// } -// } -// } -// } -// public class LancoltLista : Lista, IEnumerable -// { -// int n; -// LancElem? fej; - -// public int Elemszam -// { -// get { return n; } -// } -// public LancoltLista() -// { - -// } -// public void Felszabadit() -// { - -// } - -// public void Bejar(Action muvelet) -// { -// for (int i = 0; i < n; i++) -// { -// muvelet(Indexedik(i).tart); -// } -// } - -// public void Beszur(int index, T ertek) -// { -// if (fej == null) -// { -// if (index == 0) -// { -// Hozzafuz(ertek); -// } -// else -// { -// throw new HibasIndexKivetel(); -// } -// } -// else -// { -// if (index == 0) -// { -// fej.elozo = new LancElem(ertek, fej, null); -// fej = fej.elozo; -// n++; -// } -// else if (index == n) -// { -// Hozzafuz(ertek); -// n++; -// } -// else -// { -// LancElem? xd = Indexedik(index).elozo; -// xd.kov = new LancElem(ertek, Indexedik(index), xd.kov); -// xd.kov.kov.elozo = xd.kov; -// n++; -// } -// } -// } - -// public void Hozzafuz(T ertek) -// { -// if (Elemszam < 1) -// { -// fej = new LancElem(ertek, null, null); -// n++; -// } -// else -// { -// LancElem asd = Indexedik(n-1); -// asd.kov = new LancElem(ertek, null, asd); -// n++; -// } -// } - -// public T Kiolvas(int index) -// { -// return Indexedik(index).tart; -// } - -// public void Modosit(int index, T ertek) -// { -// Indexedik(index).tart = ertek; -// } - -// public void Torol(T ertek) -// { -// LancElem tmp = fej; -// while (tmp.kov != null) -// { -// if (ertek.Equals(tmp.tart)) -// { -// tmp.elozo.kov = tmp.kov; -// tmp.kov.elozo = tmp.elozo; - -// } -// tmp = tmp.kov; -// } -// } -// private LancElem Indexedik(int index) -// { -// LancElem? tmp = fej; -// for (int i = 0; i < index; i++) -// { -// tmp = tmp.kov; -// } -// return tmp; -// } - -// public IEnumerator GetEnumerator() -// { -// LancElem tmp = fej; -// while(tmp != null) -// { -// if (tmp.tart != null) -// { -// yield return tmp.tart; -// } -// tmp = tmp.kov; -// } -// } - -// IEnumerator IEnumerable.GetEnumerator() -// { -// LancoltListaBejaro bejaro = new LancoltListaBejaro(this.fej); -// return bejaro; -// } -// } -// class LancoltListaBejaro : IEnumerator -// { -// LancElem fej; -// LancElem aktualisElem; -// public T Current -// { -// get{ return aktualisElem.tart; } -// } - -// object IEnumerator.Current => Current; -// public LancoltListaBejaro(LancElem fej) -// { -// this.fej = fej; -// aktualisElem = fej; -// } - -// public void Dispose() -// { -// throw new NotImplementedException(); -// } - -// public bool MoveNext() -// { -// if (aktualisElem.kov == null) -// { -// return false; -// } -// { -// aktualisElem = aktualisElem.kov; -// return true; -// } -// } - -// public void Reset() -// { -// aktualisElem = fej; -// } -// } diff --git a/ALGA/05_BinarisKeresoFa.cs b/ALGA/05_BinarisKeresoFa.cs deleted file mode 100644 index c7f6b0d..0000000 --- a/ALGA/05_BinarisKeresoFa.cs +++ /dev/null @@ -1,137 +0,0 @@ -// using System; -// using System.Drawing; - -// namespace OE.ALGA; - -// internal class FaElem where T : IComparable -// { -// public T? tart; -// public FaElem? bal; -// public FaElem? jobb; - -// public FaElem(T? tart, FaElem? bal, FaElem? jobb) -// { -// this.tart = tart; -// this.bal = bal; -// this.jobb = jobb; -// } -// } -// public class FaHalmaz : Halmaz where T : IComparable -// { -// FaElem? gyoker; -// public void Bejar(Action muvelet) -// { -// throw new NotImplementedException(); -// } - -// private static FaElem ReszfabaBeszur(FaElem p, T ertek) -// { -// if (p == null) -// { -// FaElem uj = new FaElem(ertek, null, null); -// return uj; -// } -// else -// { -// if (p.tart.CompareTo(ertek) > 0) -// { -// p.bal = ReszfabaBeszur(p.bal, ertek); -// } -// else -// { -// if (p.tart.CompareTo(ertek) < 0) -// { -// p.jobb = ReszfabaBeszur(p.jobb, ertek); -// } -// } -// return p; -// } -// } -// public void Beszur(T ertek) -// { -// gyoker = ReszfabaBeszur(gyoker, ertek); -// } - -// private static FaElem ReszfaEleme(FaElem p, T ertek) -// { -// FaElem? tmp = null; -// if (p == null) -// { -// return tmp; -// } -// else -// { -// if (p.tart.CompareTo(ertek) > 0) -// { -// tmp = ReszfaEleme(p.bal, ertek); -// } -// else if (p.tart.CompareTo(ertek) < 0) -// { -// tmp = ReszfabaBeszur(p.jobb, ertek); -// } -// else -// { -// return tmp; -// } -// return tmp; -// } -// } -// public bool Eleme(T ertek) -// { -// return !(ReszfaEleme(gyoker, ertek) == null); -// } -// private static FaElem KetGyerekesTorles(FaElem p, FaElem ertek) -// { -// if (p.jobb != null) -// { -// p.jobb = KetGyerekesTorles(p.jobb, ertek); -// return p; -// } -// else -// { -// ertek.tart = p.tart; -// p = p.bal; -// return p; - -// } -// } -// private static FaElem ReszfabolTorol(FaElem p, T ertek) -// { -// if (p == null) -// { -// throw new NincsElemKivetel(); -// } -// if (p.tart.CompareTo(ertek) < 0) -// { -// p.bal = ReszfabolTorol(p.bal, ertek); -// } -// else if (p.tart.CompareTo(ertek) > 0) -// { -// p.jobb = ReszfabolTorol(p.jobb, ertek); -// } -// else -// { -// if (p.jobb == null && p.bal == null) -// { -// p = null; -// } -// else if (p.jobb == null && p.bal != null) -// { -// p = p.bal; -// } -// else if (p.jobb != null && p.bal == null) -// { -// p = p.jobb; -// } -// else -// { -// p = KetGyerekesTorles(p, p); -// } -// } -// return p; -// } -// public void Torol(T ertek) -// { -// ReszfabolTorol(gyoker, ertek); -// } -// }