Search Results


34 matches found for 'optimization'

RDBMS Optimization

... Example: Pre-join tables beforehand to avoid expensive join calls Federation Another optimization for relational databases is to simply have more than one DBs. Each DB can represent a functionality of your application.


Distributed scaling with Relational Databases

... systems space, which are covered here. Replicas for higher read throughput The easiest optimization with SQL by far is adding replicas. This is used for replication and they offer a few amazing benefits: Fault Tolerance In the case of leader-follower replications, if the leader dies, a follower or replica node can take over via failover More Read Throughput Theoretically, if you had one node vs.


P vs. NP

P vs. NP is a millenium-prize problem in Computer Science that has not been proven yet. Are all P in NP? Or are all NP in P? What is NP-Complete? P vs. NP When we talk about P or NP, we generally talk about decision problems, which means the algorithms always output a "yes" or a "no".


Greedy Algorithms

There are many definitions of greedy algorithms, but in general, they have two properties: You build the solution by finding the most optimal answer at each local step. As you go through each local step, you do not backtrack; the answer you've picked for all of the previous steps remain the same.


Rotate a 2D Matrix

... value, so that we can offset the rotation pattern like in the animation above. The practical optimization for this problem is to just reduce the loop range by half as the square to process iteratively gets smaller and smaller until it reaches the middle.


Big Data Processing: Batching vs. Streaming

Intro In data processing, we often have to work with large amounts of data. The way in which this data is gathered comes in a few variants: batching, where we aggregate a collection of data (e.g., by hourly time), streaming for data that needs to be processed in real-time, and a unified variant which simply does not distinguish the technical difference between batching and streaming, allowing you to programmatically use the same API for both.


Perfect Squares

... relation: \( leastSquares = min(f((total - perfSquares[j]), i+1), f(total, i)) \) One optimization is to cache results, using a hash table, and recursively iterate from the smallest perfect square to the biggest perfect square.


Data stores in Software Architectures

Use Cases There are many ways to store your data. In this article we'll walk through some examples of data storage in common system designs. Reminder: There is no single best storage choice and they may vary heavily depending on things such as access patterns and scale.


Machine Learning Basics

Supervised Learning In supervised learning, we take some data and predict an output in a pre-defined structure. There are two categories: Regression: When a function is given some input variables, what is the continuous output? i.


Find the maximum min path

... _find_max_min(0, 0, float('inf')) return result Solution (Optimized) An optimization is to use dynamic programming, as the previous solution will repeatedly visit blocks that were visited before.


Algorithm Handbook

Introduction Welcome to the algorithm handbook wiki! In this wiki you will find a mini-cheat sheet overview of data structures, and examples of their usages in modern languages. Algorithm problems can be found here.


CSR vs. SSR

... downfall is that CSR and Single-page applications (SPA) can often lead to search engine optimization (SEO) issues. React and Angular are primarily frameworks for building SPA.


Comparison Charts of File Storage Formats

Big Data Encodings These encodings are often used with HDFS or some other distributed file system. Since the data can be as large as terabytes or petabytes, it is crucial to encode files in a space optimal way and also allow themselves to be read or written in an optimal way.


Counting the path of sums

Description Given a binary tree with nodes containing integer values (positive or negative), how can you count up all the paths that equal to some target sum? Note, that the paths do not have to start from the root; it may start from any sub-tree and end at another sub-tree, as long as the path goes down the tree.


Sharding Techniques

Introduction Sharding can be summarized as a technique in which a database table can be split into multiple database servers to optimize read/write performance. Benefits include: Optimized query time Instead of having one huge database table, you have multiple smaller tables in more than one machine.


Overlapping linked lists

Given two linked list nodes, one might overlap the other. That is, one linked list might contain a sequence that is already in the other linked list. The two linked lists share a common node. Problem Build a function that takes two singly linked lists and returns a boolean output that signifies whether or not the two linked lists share a common node.


B-Trees vs. LSM Trees

B-Trees Modern databases are typically represented as B-Trees or LSM Trees (Log structured merge trees). B-trees are "tried and true" data structures that are popular in database usage, most notably SQL databases.


Build a Binary Tree with Pre-order and In-order traversal data

Problem Given a pre-order traversal array of integers and an in-order traversal array of integers, construct a binary tree. Input preorder - array of integers inorder - array of integers # Definition for a binary tree node.


Build a Trie in Python

Problem In computer science, a trie (pronounced "try"), also called digital tree, radix tree or prefix tree, is a kind of search treeā€”an ordered tree data structure used to store a dynamic set or associative array where the keys are usually strings.


Longest Substring Without Repeating Characters

Problem Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3.


Buy and Sell Two Stocks

Problem Given an array of integers representing stock prices, with each index representing a different day, find the maximum profit by selling at most two stocks. The buy/sell dates must not overlap.


Symmetry in a Tree

var jsav = new JSAV("av-sym"); jsav.label("Symmetric tree"); var bt = jsav.ds.binarytree(); bt.root("5"); // set the value of the root bt.root().left("3"); // set left child bt.


Cyclic Permutation

... about O(n) in space complexity and O(n) in time complexity. This is a nice starting ground for optimizations. The trickier follow-up solution There is a way to reduce the space complexity here from O(n) to O(1).


Merge Intervals

... Solution This solution has \(O(n log(n))\) time complexity and constant extra space. A small optimization to this solution involves ditching the use of namedtuple, since creating a new tuple each time we update the current MergeSequence is a bit wasteful.


Javascript Essentials

... is due to the fact that eval() will modify the lexical scope at runtime, nullifying performance optimizations by the Javascript interpreter that rely on a non-changing lexical scope.


What is DDD? What is CQRS?

Domain Driven Design DDD is an approach to developing software systems that is large and complex, and has ever-changing business rules. DDD captures the sweet spot between the business knowledge and the code.


NoSQL - the Radical Databases

NoSQL NoSQL is a category of databases that aren't relational. For example, MySQL would be a relational database, where as MongoDB would be a NoSQL database. Back then, relational databases were the tried-and-true, prevalent and reliable data stores.


CAP Patterns

The CAP Theorem dictates that only two of its three characteristics can be guaranteed at any given time. Intro to CAP Consistency Every read will be based off of the latest write Availability Every request will be given a response, although the response data might be stale Partition Tolerance It can handle network partitions or network failures MTV's The Real World If your service is in the cloud, the P in Partitioning has to always be accounted for.


Replace all occurrences of a space inside an array

Problem Given an array of characters, replace all occurrences of a space with another string. Assume that the array has enough space to contain all of the replacements. Input A - An array of characters which may or may not have spaces word - The string to replace spaces with.


HTML and CSS Concepts

HTML Hypertext Markup Language is the standard markup language for creating web pages and web applications. It was created by Tim Berners and it represents a document in the world wide web. DOM The DOM is an interface that treats a HTML document as a tree structure wherein each node is an object representing a part of the element.


React HOC vs. Hooks

HOC React HOC (Higher Order Components) are basically a function that takes a component and returns a new component. props are passed in as an argument to this function. React HOCs are generally used for: Components that share a common layout Components that need to be connected to some middleware (i.


Seattle Conference on Scalability: YouTube Scalability

Notes Apache isn't that great at serving static content for a large number of requests vs. NetScaler load balancing Python is fast enough There are many other bottlenecks such as waiting for calls from DB, cache, etc.


OS 101

Kernel A kernel is the core software application of the operating system. It is generally not intended to be interacted with from a user-level perspective. Some responsibilities it can handle: Hardware management e.


NumPy vs. Pandas, and other flavors (Dask, Modin, Ray)

NumPy NumPy is a Python library for numerical computing that offers multi-dimensional arrays and indices as data structures and additional high-level math utilities. ndarray The unique offering of NumPy is the ndarray data structure, which stands for n-dimensional array.