Matrix-Based Lazy Propagation for Segment Trees

Managing multiple interdependent lazy operations in segment trees often requires tedious case analysis for tag composition and priority resolution. Representing state transitions as matrix multiplications provides a unified algebraic framework. Each tree node maintains a state vector, while pending operations are encoded as transformation matri ...

Posted on Sun, 25 Oct 2026 16:52:34 +0000 by fotofx

2D Point Counting via Sweep Line and Fenwick Tree

Core Idea The fundamental approach to rectangle point counting problems involves sorting all points by their x-coordinate, then reducing the 2D problem to a 1D problem on y-coordinates. As we sweep across the x-axis, a Binary Indexed Tree (Fenwick Tree) maintains operations on y-values, enabling efficient querying of points within specified rec ...

Posted on Sun, 25 Oct 2026 16:38:43 +0000 by morbidchick

Union-Find Data Structure: Path Compression and Group Counting Techniques

Union-Find Data Structure Union-Find (Disjoint Set Union) is a data structure that tracks a set of elements partitioned into disjoint sets. It supports two primary operations: Find: Determine which set a particular element belongs to Union: Merge two sets into a single set This article demonstrates these concepts through two classic competiti ...

Posted on Sun, 25 Oct 2026 16:38:54 +0000 by 10legit10quit

Understanding Slices and Sub-slices in Go

Core Characteristics In Go, slices are reference types composed of three components: a pointer to the underlying array, length, and capacity. This combination forms the slice header. Key features include: Dynamic size - length and capacity can differ Reference semantics - copies share the same underlying data Built on arrays for efficient inde ...

Posted on Sat, 24 Oct 2026 16:35:35 +0000 by ivory_kitten

Operating System Fundamentals: Page Replacement and Data Structures

1. FIFO Page Replacement Algorithm The First-In-First-Out (FIFO) algorithm replaces the oldest page in memory. By using a circular linked list to represent page frames, we can efficiently track the arrival order. #include <stdio.h> #include <stdlib.h> typedef struct Frame { int id; struct Frame *next; } Frame; int executeFI ...

Posted on Thu, 22 Oct 2026 16:22:50 +0000 by Simbachips

Fundamentals of Stacks and Queues: Core Data Structures for Efficient Data Management

Stacks and Queues Stacks and queues are fundamental linear data structures used for organizing and managing data in computer science. They provide specific ways to add and remove elements, which makes them suitable for a variety of applications. Stack A stack is a linear data structure that follows the Last-In, First-Out (LIFO) principle. This ...

Posted on Sat, 17 Oct 2026 16:45:47 +0000 by kmarsh

Comprehensive Guide to Suffix Arrays, Suffix Automata, and Generalized Suffix Automata

Fundamentals of Suffix Arrays The Suffix Array (SA) is a critical data structure for efficient string analysis. It primarily relies on three interconnected arrays: Suffix Order (sa): sa[i] stores the starting index of the suffix that ranks i-th lexicographically. Rank Array (rk): rk[i] stores the lexicographical rank of the suffix beginning at ...

Posted on Sat, 17 Oct 2026 16:18:20 +0000 by jcornett

Python Dictionary Data Structure Guide

Dictionary Fundamentals A dictionary in Python is represented by curly braces {} and stores data in key-value pairs. The structure uses a hash algorithm to compute memory addresses for storing key-value combinations. Since hash tables are non-contiguous, dictionaries cannot be sliced and their contents maintain no specific order based on inser ...

Posted on Fri, 16 Oct 2026 16:44:04 +0000 by jimmyp3016

Python Skip List Implementation: Multi-Level Index Optimization

Introduction In our previous exploration, we covered a basic Skip List implementation with a single skip step of 2. While functional, this basic version doesn't fully leverage the power of skip lists. A true skip list employs multiple skip levels, allowing for even faster lookups by skipping over more elements. This article demonstrates how to ...

Posted on Wed, 14 Oct 2026 16:01:22 +0000 by ev66

Merging Segment Trees: Implementation and Applications

Segment Tree Merging Fundamentals Segment tree merging combines two segment trees into one. The core algorithm processes corresponding nodes: If either node is empty, return the other Otherwise, recursively merge left and right subtrees Node* merge(Node* x, Node* y) { if (!x) return y; if (!y) return x; x->value += y->v ...

Posted on Tue, 13 Oct 2026 16:45:31 +0000 by Dodon