Esempio n. 1
0
        public object GetValueByKey(object key)
        {
            var hashdKey = key.GetHashCode();
            var id       = BinSrc.BinarySearch(keys, hashdKey);

            return(id != -1 ? values[id] : null);
        }
Esempio n. 2
0
        public void PutPair(object key, object value)
        {
            var hashdKey = key.GetHashCode();
            int id;

            if ((id = BinSrc.BinarySearch(keys, hashdKey)) != -1)
            {
                values[id] = value;
                return;
            }
            else if (num < Length)
            {
                keys[num]   = hashdKey;
                values[num] = value;
                num++;

                if (!QuickSort.IsSorted(keys))
                {
                    QuickSort.Sort(keys, values);
                }

                return;
            }
            else
            {
                Console.WriteLine("Преувличение: {0}!", num + 1);
                return;
            }
        }