Beispiel #1
0
        public IEnumerable <int> TestReverseTraverse(List <int> items)
        {
            IterativeBinarySearchTree <int> tree = new IterativeBinarySearchTree <int>(items);
            List <int> result = new List <int>();

            foreach (var item in tree.GetReversedEnumerator())
            {
                result.Add(item);
            }

            return(result);
        }
Beispiel #2
0
        public IEnumerable <int> CreateTreeFromCollectionWithComparerTest(List <int> items, IComparer <int> comparer)
        {
            IterativeBinarySearchTree <int> tree = new IterativeBinarySearchTree <int>(items, comparer);
            List <int> result = new List <int>();

            foreach (var data in tree)
            {
                result.Add(data);
            }

            return(result);
        }
        public IEnumerable <Student> CreateTreeFromCollectionTest(List <Student> items)
        {
            IterativeBinarySearchTree <Student> tree = new IterativeBinarySearchTree <Student>(items);
            List <Student> result = new List <Student>();

            foreach (var data in tree)
            {
                result.Add(data);
            }

            return(result);
        }
Beispiel #4
0
        public IEnumerable <int> AddTest(List <int> items, int item)
        {
            IterativeBinarySearchTree <int> tree = new IterativeBinarySearchTree <int>(items);

            tree.Add(item);

            List <int> result = new List <int>();

            foreach (var data in tree)
            {
                result.Add(data);
            }

            return(result);
        }
Beispiel #5
0
        public int TestSearch(List <int> items, int value)
        {
            IterativeBinarySearchTree <int> tree = new IterativeBinarySearchTree <int>(items);

            return(tree.Search(value).Data);
        }
Beispiel #6
0
        public bool TestRemove(List <int> items, int value)
        {
            IterativeBinarySearchTree <int> tree = new IterativeBinarySearchTree <int>(items);

            return(tree.Remove(value));
        }
Beispiel #7
0
        public int TestGetMin(List <int> items, IComparer <int> comparator)
        {
            IterativeBinarySearchTree <int> tree = new IterativeBinarySearchTree <int>(items, comparator);

            return(tree.GetMin(tree.Root).Data);
        }
        public Student TestGetLeft(List <Student> items, IComparer <Student> comparator)
        {
            IterativeBinarySearchTree <Student> tree = new IterativeBinarySearchTree <Student>(items, comparator);

            return(tree.GetLeft().Data);
        }
        public string TestSearch(List <string> items, string value)
        {
            IterativeBinarySearchTree <string> tree = new IterativeBinarySearchTree <string>(items);

            return(tree.Search(value).Data);
        }
        public bool TestRemove(List <string> items, string value)
        {
            IterativeBinarySearchTree <string> tree = new IterativeBinarySearchTree <string>(items);

            return(tree.Remove(value));
        }
        public string TestGetMin(List <string> items, IComparer <string> comparator)
        {
            IterativeBinarySearchTree <string> tree = new IterativeBinarySearchTree <string>(items, comparator);

            return(tree.GetMin(tree.Root).Data);
        }