static void Main(string[] args) { BinarySearchST<String, int?> st = new BinarySearchST<String, int?>(); String key = Console.ReadLine(); for (int i = 0; key != null; i++) { st.put(key, i); key = Console.ReadLine(); } foreach (var item in st.Keys()) { Console.WriteLine("{0} {1}", item, st.get(item)); } }
public void TestSearchTable() { var st = new BinarySearchST<IComparable, string>(12); string[] searchExample = new[] { "S", "E", "A", "R", "C", "H", "E", "X", "A", "M", "P", "L" }; foreach (string val in searchExample) { st.Put(val, val); } Array.Sort(searchExample); foreach (IComparable comparable in st.Keys()) { Console.Write(comparable); } Assert.AreEqual(true, true); }
public static void Main(string[] args) { BinarySearchST<string, int?> bsst = new BinarySearchST<string, int?>(); // Adaug in colectie 3 perechi (cheie, valoare) bsst.put("Marin", 34); bsst.put("Ionel", 22); bsst.put("Cornel", 45); // Afisez elementele colectiei foreach (var item in bsst.Keys()) { Console.WriteLine(item); } // Determin numarul de elemente din colectie Console.WriteLine("Dimensiunea tabelei simbolice este {0}", bsst.size()); string nume = "Marin"; if (bsst.contains(nume)) { Console.WriteLine("{0} are {1} ani", nume, bsst.get(nume)); } else { Console.WriteLine("{0} nu se afla in colectie", nume); } bsst.put(nume, 35); Console.WriteLine("{0} are {1} ani", nume, bsst.get(nume)); // Elimin din colectie o pereche (cheie, valoare) bsst.put(nume, null); foreach (var item in bsst.Keys()) { Console.WriteLine(item); } }
public void DeleteMin_Empty_Test() { var st = new BinarySearchST<string, string>(); st.DeleteMin(); }
public void Size_Zero_Test() { var st = new BinarySearchST<string, string>(); Assert.AreEqual(0, st.Size()); }
public void Select_IntNull_Test() { var st = new BinarySearchST<int, int?>(new int[] { 1, 2, 3 }, new int?[] { 10, 11, 12 }); var val = st.Select(-1); }
public void Get_Empty_Test() { var st = new BinarySearchST<string, string>(); Assert.IsNull(st.Get("a")); }
public void Delete_Olny_One_Node_List_Test() { var st = new BinarySearchST<string, int?>(new string[] { "a" }, new int?[] { 0 }); st.Delete("a"); Assert.AreEqual(0, st.Size()); }