/// <summary>
        /// deletes an entry from this suffix tree
        /// O(m^2) complexity if m is the length of the entry to be deleted
        /// </summary>
        /// <param name="entry"></param>
        public void Delete(T[] entry)
        {
            if (entry == null)
            {
                throw new ArgumentException();
            }

            for (var i = 0; i < entry.Length; i++)
            {
                var suffix = new T[entry.Length - i];
                Array.Copy(entry, i, suffix, 0, entry.Length - i);

                trie.Delete(suffix);
            }
            Count--;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Deletes an existing entry from this suffix tree.
        /// Time complexity: O(m^2) where m is the length of entry array.
        /// </summary>
        public void Delete(T[] entry)
        {
            if (entry == null)
            {
                throw new ArgumentException();
            }

            if (!items.Contains(entry))
            {
                throw new Exception("Item does'nt exist.");
            }

            for (var i = 0; i < entry.Length; i++)
            {
                var suffix = new T[entry.Length - i];
                Array.Copy(entry, i, suffix, 0, entry.Length - i);

                trie.Delete(suffix);
            }

            items.Remove(entry);

            Count--;
        }