Пример #1
0
        public void SingletonTreeSuccessfulLookup()
        {
            KevinBst <string> stringTree = new KevinBst <string>();
            int    key   = 20;
            string value = key.ToString();

            stringTree.Insert(key, value);
            Assert.AreEqual(stringTree.Lookup(key), value);
        }
Пример #2
0
        public void SingletonTreeFailedLookup()
        {
            KevinBst <string> stringTree = new KevinBst <string>();
            int    key   = 20;
            string value = key.ToString();

            stringTree.Insert(key, value);
            stringTree.Lookup(key + 1);
        }
Пример #3
0
        private KevinBst <string> BuildTestTree()
        {
            KevinBst <string> bst  = new KevinBst <string>();
            List <int>        keys = new List <int>()
            {
                20,
                10,
                30,
                5,
                15,
                25,
                35
            };

            foreach (int key in keys)
            {
                bst.Insert(key, key.ToString());
            }

            return(bst);
        }