static void Main()
    {
        OurHashTable<int, int> hassTable = new OurHashTable<int, int>();

        for (int i = 0; i < 20; i++)
        {
            hassTable.Add(i, 1 + i);
        }

        Console.WriteLine(hassTable.Find(6));

        hassTable[6] = 333;

        Console.WriteLine(hassTable[6]);

        Console.WriteLine(hassTable.Keys);

        foreach (var item in hassTable)
        {
            Console.WriteLine("{0} -> {1}", item.Key, item.Value);
        }
        hassTable.Add(30, 1);
        hassTable.Add(300, 1);
        hassTable.Add(3000, 1);
        hassTable.Add(30000, 1);

        hassTable.Add(40, 1);
        hassTable.Add(400, 1);
        hassTable.Add(4000, 1);
        hassTable.Add(40000, 1);

        Console.WriteLine(hassTable.Count);
        Console.WriteLine(hassTable.Capacity);
    }
Esempio n. 2
0
    static void Main()
    {
        OurHashTable <int, int> hassTable = new OurHashTable <int, int>();

        for (int i = 0; i < 20; i++)
        {
            hassTable.Add(i, 1 + i);
        }

        Console.WriteLine(hassTable.Find(6));

        hassTable[6] = 333;

        Console.WriteLine(hassTable[6]);

        Console.WriteLine(hassTable.Keys);

        foreach (var item in hassTable)
        {
            Console.WriteLine("{0} -> {1}", item.Key, item.Value);
        }
        hassTable.Add(30, 1);
        hassTable.Add(300, 1);
        hassTable.Add(3000, 1);
        hassTable.Add(30000, 1);

        hassTable.Add(40, 1);
        hassTable.Add(400, 1);
        hassTable.Add(4000, 1);
        hassTable.Add(40000, 1);

        Console.WriteLine(hassTable.Count);
        Console.WriteLine(hassTable.Capacity);
    }
 static void Main(string[] args)
 {
     OurHashTable<string, int> test = new OurHashTable<string, int>();
     test.Add("gosho", 5);
     test.Add("pesho", 10);
     test.Add("Sasho", 15);
     Console.WriteLine(test.Find("pesho"));
     Console.WriteLine(test["gosho"]);
 }
Esempio n. 4
0
        public OurHashedSet(params T[] values)
        {
            this.container = new OurHashTable <T, T>();

            if (values != null)
            {
                for (int i = 0; i < values.Length; i++)
                {
                    this.container.Add(values[i], values[i]);
                }
            }
        }
Esempio n. 5
0
        public void IntersectWith(OurHashedSet <T> otherSet)
        {
            OurHashTable <T, T> otherTable = new OurHashTable <T, T>();

            foreach (var item in otherSet)
            {
                if (this.container.Contains(new KeyValuePair <T, T>(item, item)))
                {
                    otherTable.Add(item, item);
                }
            }

            this.container = otherTable;
        }
Esempio n. 6
0
 public BiDictionary()
 {
     this.firstKeyTable  = new OurHashTable <T, List <L> >();
     this.secondKeyTable = new OurHashTable <K, List <L> >();
     this.bothKeysTable  = new OurHashTable <string, List <L> >();
 }
Esempio n. 7
0
 public void Clear()
 {
     this.container = new OurHashTable <T, T>();
 }