Algorithm Helper (the good stuff)

API Fundamentals

An API is an application programming interface. It defines a way for applications to talk to each other to exchange data. APIs are commonly used when discussing how clients can make requests to a web server, but they are used beyond internet-based apps. Libraries and other systems also expose an API which clients must understand. In this discussion, however, we will focus on RESTful API concepts, which are APIs that deal with resources.

July 05, 2018 | Rahul Pandey


Dijkstra's Algorithm for Shortest Path

Dijkstra’s algorithm is a method to find the shortest paths between nodes in a graph. In particular, Dijkstra’s algorithm solves the single-source shortest path problem: find the shortest path from a single node to all other nodes in the graph. We assume in the discussion below that the graph G on which we operate is connected, undirected, and each edge has a nonnegative weight [1]. We can think of the graph as a collection of major cities (nodes) connected by highways of a certain distance (edges).

May 16, 2017 | Rahul Pandey


Bits and Bytes

Computers work with the simplest possible unit of data: a bit (short for binary digit). A bit has value 0 or 1. Groups of 8 bits together make up a byte. Computer memory is discussed in terms of bytes, such as a kilobyte or megabyte. Hexadecimal, or base 16, is used to represent 4 bits as a time, so a byte is represented as 2 hexadecimal digits. Since 24 is 16, each digit in hexadecimal can take on 16 possible values: 0-9 represent zero to nine, and A-F represent ten to fifteen. For example, a byte could be 0xA3, where the 0x prefix is used to indicate hexadecimal (the value of 0xA3 in decimal is 163).

April 10, 2017 | Rahul Pandey


Bloom filters

Bloom filters are a probabilistic data structure which tell us that an element is definitely not in a set, or it may be in a set. Bloom filters are designed to give you an answer to (potential) element existence very quickly and memory-efficiently. When constructing a Bloom filter, elements can be added to the set but not removed. The more elements added to the set, the larger probability of false positives.

March 24, 2017 | Rahul Pandey


Effective Java

Effective Java is a programming guide written by Josh Bloch, initially published in 2001 and updated in 2008. The former “Chief Java Architect” at Google, Bloch does an excellent job in distilling best practices in Java, and the reasoning behind it. The ideas presented can be transferred to other languages. Here’s my attempt to summarize some insightful sections.

March 16, 2017 | Rahul Pandey


Heap

The Heap data structure is a data structure that maintains a set of items in a semi-ordered manner where the smallest (or largest) item can be retrieved quickly. The beauty of it comes from its ability to efficiently support updates, such as deletions or insertions of items. The heap can either be a min-heap or a max-heap. The min-heap allows fast retrieval of the smallest item, while the max-heap allows fast retrieval of the largest item.

March 10, 2017 | Pong Eksombatchai


Suffix Trees

The suffix tree, invented in 1973, is probably the most powerful and versatile data structure for string processing. The suffix tree represents all the suffixes of a string S in O(n) space and can be built in O(n) time, where n is the length of the string.

February 14, 2017 | Rahul Pandey


Concurrency

Concurrency is a fundamental tool for maximizing performance and CPU power. Concurrency is a mechanism which deserializes programming instructions and allows multiple threads to be run simultaneously on the same processing core. We’ll clarify what all this means below, but for illustration imagine a grocery store. Shoppers can be thought of having a set of instructions, e.g. “get milk, eggs, kombucha”. Grocery stores would be extremely inefficient if they allowed only one shopper in at a time, and instead have a concurrent process for many shoppers. This example may sound trivial, but consider that much code is written serially.

February 12, 2017 | Christian Griset


Union Find

The Union Find (also called Disjoint Sets) data structure is a data structure to merge disjoint sets efficiently. The context is that you have a large number of items partitioned into several smaller sets. All items are part of exactly 1 set, and there is no overlap between any 2 sets. The supported operations are:

January 31, 2017 | Rahul Pandey