Articles for category: Data Structures and Algorithms

AVL Trees

AVL (Adelson-Velsky and Landis) Tree is a self-balancing binary search tree that can perform certain operations in logarithmic time. It exhibits height-balancing property by associating each node of the tree with a balance factor and making sure that it stays between -1 and 1 by performing certain tree rotations. This property prevents the Binary Search ...

What is Linear Data Structure?

A linear data structure is one in which data items are ordered sequentially or linearly, with each member attached to its previous and next neighboring elements. All the elements in the linear data structure can be traversed in a single run. Arrays, Linked List, Stack and Queue are the different types of linear data structures ...

Advanced Nim’s Game

The Nim Game is a combinatorial game that involves a number of piles of stones or coins and two players playing the game. In each turn, one player chooses a pile and removes a non-zero number of stones or coins from the pile. The person who cannot make a move loses in the end. We ...

Biconnected Components

A bioconnected component of a graph is a connected subgraph that cannot be broken into disconnected pieces by deleting any single node (and its incident links). An articulation point is a node of a graph whose removal would cause an increase in the number of connected components. Scope **Before diving into Biconnected components let’s first ...

Treap

Treap is a very useful data structure in computer science, it is used to solve various problems like connectivity problems, range query problems and can be used as good alternatives to segment trees/sparse tables and splay trees in some of the scenerios as they are relatively also easier to code.It uses randomization of nodes which ...

Splay Tree

Splay Tree in data structures is a type of binary search tree that uses a splaying operation on the tree so the most frequently used elements can come closer to the root. This increases the insertion, deletion, and search operations in the tree. Scope of the Article Introduction to Splay Tree As we know, the ...

2D DP Problems

In this article, we shall discuss the most important and powerful programming technique known as dynamic programming which is quite useful in solving problems in coding contests and comes as an improvement over the brute-force, recursive/backtracking solutions which gives exponential time complexity. Dynamic programming technique indeed improves the time complexity but at the cost of ...

Bit Masking

A bit is a boolean value that can be either 0 or 1. Bitmasking is the act of applying a mask over a value to keep, change or modify a piece of given information. A mask determines which bits to take and which bits to clear off a binary number. Bitmasking can be used to ...

Kruskal’s Algorithm

Kruskal's algorithm is a greedy algorithm in graph theory that is used to find the Minimum spanning tree (A subgraph of a graph $G(V,E)$ which is a tree and includes all the vertices of the given graph such that the sum of the weight of the edges is minimum) of a given connected, weighted, undirected ...

Fenwick Tree | Binary Indexed Tree

The Binary Indexed Tree, also known as the Fenwick tree, provides an efficient way to calculate prefix sums of a series of numbers, especially in scenarios where the values are mutable.Unlike prefix sum arrays, which excel in answering prefix sum queries but struggle with frequent updates, Fenwick trees offer a balance between efficient query answering ...