Search Results


11 matches found for 'graph'

4 Line Depth-first Search

Context Depth-first search (DFS) is a common searching algorithm for graphs, alongside Breadth-first search (BFS). DFS is useful for finding ways to solve mazes. It is also a vital ingredient for topological sorting.


Topological Sorting

... N-degree (or in-degree) array is a mapping of indices (the vertex ID) to the count of incoming graph edges. This N-degree array is used to maintain the number of edges that are still attached to a given vertex.


Flip adjacent colors in a 2D matrix

Problem Given a 2D array of black-and-white points and an entry point, flip the color of all points connected to the entry point (including the entry point itself). Input A: 2D boolean array of size greater than \(n\) \times \(m\), where False represents the color black and True represents the color white.


Find a path in a maze from start to finish

Problem Given a 2D array which represents a maze, a start point, and an end point, find a path from the start point to the end point if it exists. Input maze: 2D boolean array of size greater than 1 x 1, where False represents a wall (not traversable) and True represents an empty space (traversable) start: an object with x, y coordinates end: an object with x, y coordinates Approach The key to solving this problem is DFS.


NoSQL - the Radical Databases

... NoSQL databases. Key-value store What its like: A hash map Keys are maintained in lexicographic order, allowing efficient retrieval of key ranges \(O(1)\) time lookup and writes Hash maps are pretty basic by itself, so it relies on application code if more operations are needed The basis for more complex NoSQL stores such as document stores Examples: Memcached, Redis, DynamoDB Document store What its like: A hash map but with document objects as values (i.


Algorithm Handbook

... solving a maze. A vertex degree represents the number of edges connected to a vertex. Directed (Digraph) When implementing code, keep track of states. UNVISITED = 0, VISITING = 1, VISITED = 2.


Design Concepts

... as Cassandra. Remember that NoSQL databases are pretty diverse category. For example, there are graph databases (GraphQL), columnar databases (similar to MySQL and tabled data), document based storage (MongoDB) or key-value stores (DynamoDB).


Algorithm Interview Problems

Welcome This page contains solutions to common interview problems that may be encountered. Arrays Longest Substring Without Repeating Characters Rotate a 2D Matrix Buy/Sell Two Stocks Merge Intervals Next Permutation Random Permutation Replace all occurrences of a space with a string Linked Lists Reversing sublists of singly linked lists Cycles in singly linked lists Overlapping singly linked lists Merging two sorted singly linked lists Merge k sorted lists Recursion Counting the path of sums Money Denominations Phone Number Mnemonics Unique Permutation Dynamic Programming Perfect Squares Find the Maximum Min Path Binary Trees Tree Symmetry Iterative In-Order Traversal of a Binary Tree Construct a Binary Tree from Pre-Order Traversal and In-Order Traversal BST Validate a BST Binary Heaps Merge k sorted lists Graphs Find a path in a maze from start to finish Flip colors in a matrix Search Search in a rotated sorted array Find the Duplicate Number Greedy Algorithms Queue Reconstruction By Height Trie Build a Trie in Python Invariant Compute the max.


Data stores in Software Architectures

... and also maintain the relationship between that user and the user's connections. In this case, a graph database like Neo4j is suitable, since we care about relationship properties at a high scale.


Cyclic Permutation

... 0. And now, we come to the realization that index 0 is precisely where we started. This is a graph representation of a cycle. By making use of this cyclic property, we can swap two values one at a time from the start and keep swapping until we see the start again.


Intro to Python Lambda

... the distance from the node to the goal node. You can think of the search problem as a tree or graph that contains these nodes. Anyhow, to demo-test heuristic, you can simply call: print h( (problem.