Z Thread Starter zulfi100 Joined Jun 7, 2012 656 Jan 19, 2016 #1 Hi, In the above image, I cant understand why the running time of inner loop is n*(n-1)/2? I am able to understand n* (n-1) but I cant understand why are we dividing by 2? Can some body please guide me. Zulfi.
Hi, In the above image, I cant understand why the running time of inner loop is n*(n-1)/2? I am able to understand n* (n-1) but I cant understand why are we dividing by 2? Can some body please guide me. Zulfi.
Z Thread Starter zulfi100 Joined Jun 7, 2012 656 Jan 20, 2016 #2 Hi, I am able to understand this. Actually the formula for sum of numbers from 1 to n is : ( n * (n+1))/ 2. Zulfi.
Hi, I am able to understand this. Actually the formula for sum of numbers from 1 to n is : ( n * (n+1))/ 2. Zulfi.