Wednesday, March 15, 2017

Today we start reading the paper "Big Data and Cloud Computing: A survey of the State-of-the-Art and Research Challenges" by Skourletopoulos et al. This paper talks about the comparisions of data warehouse and big data as a cloud offering.
We could calculate the TCO as per the model described here :

https://1drv.ms/w/s!Ashlm-Nw-wnWrxZ9WCvR2TEdRruC

#codingexercise
Find the n'th super ugly number which is a positive number whose factors are all in the given prime list.
For example, primes = [2,5]
Super ugly number is 1,2, 4,5,8 and the 5th super ugly number is therefore 8.

int GetUgly(List<int> primes, int n)
{
var multiples = new int[primes.Length]{primes};
var operands= new int[primes.Length]{0};
var ugly = new List<int>();
ugly.insert(1);
while (ugly.length < n)
{
var nextUgly = multiples.min();
ugly.insert(nextUgly);
for (int j = 0; j < primes.Length; j++)
{
  if (nextUgly == multiples[j])
   {
         operands[j]++;
         int start = 0;
         for (int i = 1; i <= operands[j];i++)
              start++;
         multiples[j] = primes[j] * ugly[start];
        break;
    }
}
}
return ugly.Last();
}

No comments:

Post a Comment