Exemple #1
0
    static void Main()
    {
        Console.WriteLine("I love you");
        int [] arr = { 4, 6, 1, 8, 3, 2, 9, 0, 5, 7 };
        var    bit = new BIT(arr);

        bit.Display();
        Console.WriteLine();
        for (int i = 0; i < arr.Length; i++)
        {
            Console.Write(bit.Sum(i) + " ");
        }
        bit.Update(10, 7);
        Console.WriteLine();
        for (int i = 0; i < arr.Length; i++)
        {
            Console.Write(bit.Sum(i) + " ");
        }
        Console.Write(bit.Sum(1) - bit.Sum(0));
    }