Monday, October 30, 2017

We were discussing storing the product catalog in the cloud. MongoDB provides cloud scale deployment. Workflows to get data into MongoDB however required organizations to come up with Extract-Transform-Load operations and did not deal with json natively. Cloud scale deployment of MongoDB let us have the benefit of relational as well as document stores. Catalogs are indeed considered a collection of documents which are reclassified or elaborately named and tagged items. These digital assets also need to be served via browse and search operations which differ in their queries. Cloud scale deployments come with extensive monitoring support. This kind of monitoring specifically look for data size versus disk size, active set size versus ram size, disk IO, write lock and generally accounts for and tests the highest possible traffic. Replicas are added to remove latency and increase read capacity.


#codingexercise
we were discussing how to find whether a given tree is a sub tree of another tree. We gave a recursive solution and an iterative solution.  The recursive solution did not address the case when the subtree is not a leaf in the original tree. Since we know that the original and subtree are distinct we can improve  the recursive solution by adding a condition that returns true if the subtree node is null and the original is not.
We could also make this more lenient by admitting mirror trees as well. a mirror tree is one where left and right may be swapped.

     4
   2  6
1  35 7
InOrder : 1 2 3 4 5 6 7
bool isEqual(Node root1, Node root2)
{
if (root1 == NULL && root2 == NULL) return true;
if (root1 == NULL) return false;
if (root2 == NULL) return true; // modified
return root1.data == root2.data && ((isEqual(root1.left, root2.left) && isEqual(root1.right, root2.right)) || (isEqual(root1.left, root2.right) && isEqual(root1.right, root2.left)));
// as opposed to return root1.data == root2.data && isEqual(root1.left, root2.left) && isEqual(root1.right, root2.right);
}

No comments:

Post a Comment