Fading Coder

One Final Commit for the Last Sprint

Implementation and Applications of Stacks and Queues

Core Concepts of Stack and Queue A stack follows the Last-In-First-Out (LIFO) principle, while a queue operates on First-In-First-Out (FIFO). In C++'s Standard Template Library (STL), both std::stack and std::queue are implemented as container adapters rather than standalone containers. They provide...

Summing Two Numbers Represented by Linked Lists

The problem involves adding two non-negative integers represented by linked lists where digits are stored in reverse order. Each node contains a single digit. The result should also be returned as a linked list with digits in reverse order. It is assumed that the input lists do not contain leading z...

Implementing a Dynamic Sequential List in C

A sequential list represents a linear collection where elements are stored in contiguous memory locations. This adjacency mirrors logical relationships through physical proximity. While fundamentally equivalent to an array, a sequential list abstracts away fixed-size limitations by managing underlyi...

Dynamic Array List Operations in C

Structure DefinitionUsing a type alias simplifies future modifications to the stored data type. Changing the alias definition updates the type across the entire codebase without altering multiple declarations.typedef int Item; typedef struct { Item* data; int count; int limit; } DynamicVector;Capaci...

Eight Core Patterns for Arrays and Linked Lists

Array Manipulation Merge Sorted Arrays In-Place Given two integer arrays sorted in non-decreasing order, combine them into a single sorted sequence stored inside the first array. The first array has enough trailing buffer (initialized to zero) to hold all elements from the second array. Start fillin...

Sparse Table Implementation for Range Queries and Binary Lifting

Sparse Table (ST) is a data structure for answering range queries on static arrays. It differs from standard dynamic programming approaches by storing information only for intervals with lengths that are powers of two. Standard interval DP might define a state dp[l][r] representing data for the inte...

Implementing a Doubly Circular Linked List with Sentinel Node in C

A doubly circular linked list augmented with a sentinel node (dummy head) represents one of the most robust sequential data structures in low-level programming. Unlike singly linked variants, this architecture maintains bidirectional references and circular connectivity, enabling O(1) operations at...

Basic Binary Tree Operations in C

To implement binary tree operations in C, a queue is used for level - order traversal and checking if a tree is a complete binary tree (unlike C++ which may not need an external queue structure for some operations). Here are the core operations: Constructing a Binary Tree Node The CreateBinaryTree f...

Implementing and Validating Red-Black Tree Insertion Operations

Red-Black Trees are a type of self-balancing binary search tree (BST) that enforce a set of coloring rules to maintain approximate balance, ensuring efficient search, insertion, and deletion operations. Their properties guarantee that the longest path from root to leaf is no more than twice the leng...

Linked List Fundamentals and Core Operations: Element Removal, Custom Implementation, and Reversal

Linear data structures fall into two primary categories: contiguous arrays and linked sequences. A linked sequence organizes elements as self-contained units connected via references. Each unit, called a node, holds two parts: stored data and a reference pointing to the subsequent node, with the fin...