Esempio n. 1
0
        //O(n) time complexity
        public ArrayList <TreeDictionaryNode <TK, TV> > GetAll()
        {
            var nodes = binarySearchTree.GetAllNodes();

            var allNodeValues = new ArrayList <TreeDictionaryNode <TK, TV> >();

            foreach (var node in nodes)
            {
                allNodeValues.Add(node);
            }

            nodes.Clear();

            return(allNodeValues);
        }
        //O(n) time complexity
        public ArrayList <TreeDictionaryNode <K, V> > GetAll()
        {
            var nodes = binarySearchTree.GetAllNodes();

            var allNodeValues = new ArrayList <TreeDictionaryNode <K, V> >();

            for (int i = 0; i < nodes.Count; i++)
            {
                allNodeValues.Add(nodes[i]);
            }

            nodes.Clear();

            return(allNodeValues);
        }