Category: Root

Adapter Design Patterns

Adapter Design Patterns What is a design pattern? What is a Structural Design Pattern? What is an Adapter Design Pattern? What is the purpose of the Adapter Design Pattern? What is the category of the Adapter Design Pattern? Provide use cases where you can use a Adapter design pattern. How do you implement the Adapter …

Continue reading

Shirt Collection and Mongo Queries

MongoDB: Shirts Colection, and Some Mongo Queries

MongoDB: Insert, Collection, Aggregate, Lookup

db.orders.insertMany( [   { “_id” : 1, “item” : “almonds”, “price” : 12, “quantity” : 2 },   { “_id” : 2, “item” : “pecans”, “price” : 20, “quantity” : 1 },   { “_id” : 3  }] ) db.inventory.insertMany( [   { “_id” : 1, “sku” : “almonds”, “description”: “product 1”, “instock” : 120 },   { “_id” : …

Continue reading

MongoDB: Lookup and Aggregate: Reference Model

Binary Tree Traversal using In Order: In C

Binary Tree Traversal in Post Order: In C

Pre Order Traversal of a Binary Tree in C

// pre order traversalvoid preOrder(NodePtr node) { if (node != NULL) { printf(“%s “, node->data.word); preOrder(node->left); preOrder(node->right);} }

Steps to Create a Binary Search Tree

If binary tree is empty, create a node, and assign data, point to itOtherwise : point to root node Compare the new – data – to – insert with the current node dataWe maintain a pointer say current to point to the node under visit If data matched : nothing to doIf data does not …

Continue reading

Steps to Search in a Hash Table Built Using Graph: Chaining

•Search the Hash •Read a number/word •From the user •Find the position for this number/word •in the graph (vertical array of nodes) •By dividing with N or similar •Check if any vertex node is there •In that array position (array of graph vertices) •If no vertex is there •The word is not in the hash …

Continue reading