Esempio n. 1
0
        public static BinaryIndexedTree FromArray(int[] input)
        {
            if (input is null)
            {
                return(null);
            }

            var result = new BinaryIndexedTree(input.Length + 1);
            var index  = 0;

            foreach (var item in input)
            {
                result.SetValue(index, item);
                index++;
            }

            return(result);
        }