java collection Java Collections Framework: LinkedList Reading time: 15 minutes Properties Java LinkedList Methods Implementations Java LinkedList is an implementation of the List and Deque interfaces. It is one of the frequently used List implementation class. It extends AbstractSequentialList
bitwise operation Left and Right Bit Rotation using Bitwise Operators Left Rotation Right Rotation Pseudocode Implementation Applications Question Reading time: minutes | Coding time: minutes A bitwise operation involves manipulation of one or more bits of a bit pattern. A bitwise operation can simply
String Algorithms Z Algorithm function The Z-function for a string S of length N is an array of length N where the i th element is equal to the greatest number of characters starting from the position i that coincide with the first characters of S.
java collection Java Collections Framework: ArrayList Java ArrayList is one of the most widely used Collection class. java.util.ArrayList class implements java.util.List interface. Java ArrayList also implements RandomAccess, Cloneable and Serializable interfaces. Java ArrayList class extends AbstractList class that the skeleton implementation of list
java collection Java Collections Framework: Iterable Interface The Iterable interface (java.lang.Iterable) is the root interface of the Java collection classes. The Collection interface extends Iterable interface, so all subtypes of Collection implement the Iterable interface. This interface is to represent structures whose value can be traversed one by one.
java collection Java Collections Framework: Collection Interface The Collection interface (java.util.Collection) is one of the root interfaces of the Java collection classes. A collection represents a group of objects known as its elements. The following 6 interfaces extends the Collection interface List, Set, SortedSet, NavigableSet, Queue, and Deque.
java memory management Memory Management in Java: Garbage Collection Tuning and Optimization Tuning garbage collection is an important task in designing scalable applications in Java. he three considerations for tuning are Latency Throughput and Capacity. This article presents a real life tuning example and general concepts
java memory management Memory Management in Java: Garbage Collection algorithms There are several strategies of Garbage Collection each of which is suitable fora particular use case. This is article we have explored some of the best Garbage Collection algorithms. Serial Garbage Collection, Parallel Garbage Collection, Concurrent Mark and Sweep and G1 garbage collection
suffix array Suffix Array A Suffix Array contains integers that represent the starting indices of all the suffixes of a given string, after the aforementioned suffixes have been sorted. There are two approaches to compute: O(N^2 * log N) and O(N * log N * log N) approach. Locate every occurrence of a pattern within a string
game theory Sprague-Grundy Theorem and Game of Kayle Sprague Grundy function returns smallest non negative integer which is not in the given set. Explore the application of Sprague Grundy Theorem using a famous game of Kayle. Find the complexity and implementation of Sprague Grundy theorem and game of kayle.
game theory Nimber Arithmetic : A deeper dive in Nim Explore Nimber Arithmetic in Game theory and always win a game. Nimbers have two particular operations. nim-addition and nim-multiplication. the nimbers are know as Grundy Numbers. Explore applications in the Game of Nim and odd Knight of the round table problem.
game theory Exploring The Game of Nim Nim is a mathematical game of strategy in which two players take turns removing objects from distinct heaps. The key to the theory of the game is the binary digital sum of the heap sizes "exclusive or" (xor). It is called the nim-sum. Find implementations of winning strategy and applications
Algorithms Bell Numbers: Number of partitions of a set Bell numbers are a sequence of numbers that describe the number of ways a set with N elements can be partitioned into disjoint, non-empty subsets. Dobinski's Formula Satifaction Sum of Sterling's number of second kind, The Peirce Triangle Method. First few Bell numbers are 1, 1, 2, 5, 15, 52, 203
catalan number Catalan Numbers Catalan Numbers are one of the widest used and evident number patterns. They are named after the Belgian mathematician Eugène Charles Catalan. A sequence of natural numbers that occur in various counting problems. The Catalan numbers are: 1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786,
convex hull Chan's Algorithm to find Convex Hull In computational geometry, Chan's algorithm, named after Timothy M. Chan, is an optimal output-sensitive algorithm to compute the convex hull of a set P of n points, in 2- or 3-dimensional space. The algorithm takes O(n log h) time, where h is the number of vertices of the output (the convex hull).
convex hull Graham Scan Algorithm to find Convex Hull Graham's Scan Algorithm is an efficient algorithm for finding the convex hull of a finite set of points in the plane with time complexity O(N log N). The algorithm finds all vertices of the convex hull ordered along its boundary. It uses a stack to detect and remove concavities in the boundary.
convex hull Gift Wrap Algorithm (Jarvis March Algorithm) to find Convex Hull Gift Wrap Algorithm ( Jarvis March Algorithm ) to find the convex hull of any given set of points. We start from the leftmost point (or point with minimum x coordinate value) and we keep wrapping points in a counterclockwise direction. Find pseudocode, implementations, complexity and questions
convex hull Divide and Conquer algorithm to find Convex Hull Divide and Conquer algorithm to find Convex Hull. The key idea is that is we have two convex hull then, they can be merged in linear time to get a convex hull of a larger set of points. It requires to find upper and lower tangent to the right and left convex hulls C1 and C2
java memory management Memory Management in Java: Mark Sweep Compact Copy algorithm The basic strategy to remove unreferenced objects to is identify the life objects and deleting all the remaining objects. This is divided into two phases: Mark and Sweep. Every Garbage Collection algorithm used in Java Virtual Machine starts by finding out all objects that are still alive.
convex hull Quick Hull Algorithm to find Convex Hull Quickhull is a method of computing the convex hull of a finite set of points in the plane. It uses a divide and conquer approach. It was published by C. Barber and D. Dobkin in 1995. average case complexity is considered to be Θ(n * log(n))
java memory management Memory Management in Java: Java Virtual Machine (JVM) Memory Model Understanding Java Virtual Machine Memory Model and Java Memory Management is important to tune applications for better response depending upon situation and to scale applications for serving the entire humanity as the userbase.
java memory management Memory Management in Java: Minor, Major and Full Garbage Collection The various types of Garbage Collection events cleaning out different parts inside heap memory are: Minor garbage collection Major garbage collection Full garbage collection. Analysis of garbage collection events is, also, provided.
greatest common divisor Euclidean Algorithm to Calculate Greatest Common Divisor (GCD) of 2 numbers The Euclid's algorithm (or Euclidean Algorithm) is a method for efficiently finding the greatest common divisor (GCD) of two numbers. The GCD of two integers X and Y is the largest integer that divides both of X and Y (without leaving a remainder).
Algorithms Find primes using Sieve of Eratosthenes Sieve of Eratosthenes is a simple and ancient algorithm (over 2200 years old) used to find the prime numbers up to any given limit. It is one of the most efficient ways to find small prime numbers. Implementations in C, C++, C Sharp, Java, Go, Haskell, JavaScript, PHP and Python.
double ended queue Double Ended Queue (Deque) A double ended queue also called as deque (pronounced as ‘deck’ or ‘dequeue’) is a list in which the elements can be inserted or deleted at either end in constant time.