Saturday, February 4, 2017

Today we continue to compare networking capabilities in the azure and aws public clouds. We compared Security, Security Groups, Network ACLs, Custom routing tables, Virtual network interfaces, DNS service, connectivity, VPN over IPSec, private connectivity over Exchange, SDK & Tools.We also reviewed CDN And traffic Manager from Azure. Let us look at VPN Gateway.
A VPN Gateway is a type of virtual network gateway that sends encrypted traffic across a public connection.  A VPN gateway can be of two types - ExpressRoute and vpn.  We are interested only in the latter category. A multisite connection establishes multiple connections to the same vpn gateway.
In such a setting, all the VPN tunnels share the available bandwidth for the gateway. Using the powershell and Azure portal, a vpn gateway settings can be configured.

#puzzle
There are three boxes of gold, silver and mixture. These boxes are all labeled incorrectly. How can we tell them apart if we are given only one choose to pick and open a box.
Solution. The box that is labeled mixed should be chosen. If it turns out to be silver, the box labeled silver will gold and the other will be mixed. If it is gold, the other two can similarly be found.  The mixture may contain silver or gold on the top layer, the label can still tell apart the similar looking content.

#codingexercise
Given k as number of floors and n as number of eggs, find the minimum number of trials needed to determine which floor is the highest and yet safe to drop an egg from.

int GetTrials(int n, int k)
{
if (k == 1 || k == 0) return k;

if ( n == 1) return k;
int min = INT_MAX;
for ( int i = 1; i <= k; i++)
{
    int result =  Math.max(GetTrials(n-1, k-1), GetTrials(n, k-i));
    if (result < min)
         min = res;
}
return min + 1;
}
Another way to look at it is to divide the floors by 2 for each egg drop. each subsequent egg in its lifetime divides and narrows down  the range further
// pseudocode to illustrate
assert(log(floors) <= eggs);
void GetTrials(int floors, int eggs, int int start, int end,  ref int trial)
{
if (start==end || eggs == 0) return;
int next = start+1;
for (int i = 0; 2^i <= end; i++)
     if (2^i > start) {
          next = 2^i;
          break;
     }
next = min(next, (start+end)/2);      
if (break(next))
{
end = next;
trials +=1;
eggs --;
GetTrials( floors, eggs, start, end, ref trials);
}else{
start = next;
trials += 1:
GetTrials(floors, eggs, start, end, ref trials);
}
}

No comments:

Post a Comment