text: Q:
  
  Time Complexity of the following Code that uses 3 nested loops
  
  Can someone please explain the proper time Complexity of this code below.
  int sum,i,j,k,n;
  sum = 0;
  cin>>n;
  int arr * = new int[n];
  for (i=1;i<n;i=i*2){
     cin>>arr[i];
     for (j=0;j<n;++j)
         for (k=1;k<=n;k=k*2)
             sum+=arr[j];
  }
  
  A:
  
  The bounds of the three for loops do not appear to have any interdependencies.  So, we should be able to figure out the overall running time by just multiplying together the complexities of the three loops.
  The loops in i and k are O(lgN), because they double the loop counter at each iteration.  The middle loop in j is O(N).  This yields O(N*lgN*lgN) as the overall complexity.
  
  