Saturday, January 7, 2017

We continue discussing the paper by Papadimitriou  - Algorithms, Games and Internet. We started with Nash equilibrium and then we discussed Internet Equilibria. We viewed the latter in terms of multi commodity flow network where the maximum total flow in a subgraph is in the core of a coalition game. we saw the definition of core to hint at optimal set. Next we looked at markets.  Markets are known for price equilibrium. and then we discussed mechanism design problems.
A mechanism design problem is one which has N agents. These agents must make a collective choice from some set X of possible alternatives. However each agent before making a choice privately observes his preferences over the alternatives in X also referred to as his type which means he or she is guided by his or her own interest. Hence this is considered a game of incomplete information.A mechanism is a collection of a finite number of strategy sets and an outcome function based on the strategy sets taken together.A mechanism combined with a profile of possible types, the probability density of the possible realization of types, and the utility functions define a game of incomplete information.

#codingexercise
Print boundary nodes of a binary tree
   - print the left boundary from top to bottom
   - print the leaf nodes of the tree on both left and right
   - print the right boundary from bottom to top
void GetBoundary (Node root)
{
    if (root == null) return;
    Console.WriteLine(root.data);
    GetBoundaryLeft(root.left);
    GetLeaves((root.left);
    GetLeaves(root.right);
    GetBoundaryRight(root.right);

}

void GetLeaves(Node root)
{  
    if (root == null) return;
    GetLeaves(root.left);
    if ( root.left == null && root.right == null)
        Console.WriteLine(root.data);
    GetLeaves(root.right);
}

void GetBoundaryLeft(Node root)
{
  if (root == null) return;
  if (root.left)
  {
  Console.WriteLine(root.data);
   GetBoundaryLeft(root.left);
  }
  else if( root.right )
  {
  Console.WriteLine(root.data);
   GetBoundaryLeft(root.right);
  }
}
void GetBoundaryRight(Node root)
{
    if (root == null) return;
    if ( root->right )
   {
     GetBoundaryRight(root.right);
     Console.WriteLine(root.data);
   }
   else if ( root.left )
   {
     GetBoundaryRight(root.left);
     Console.WriteLine(root.data);
   }

}

No comments:

Post a Comment