Implementing and Understanding Singly Linked Lists in C
A linked list organizes elements using non-contiguous memory blocks. Each node holds a data field and a pointer to the next node, forming a chain. The basic structure is defined as follows:
typedef struct SNode {
int value;
struct SNode *next;
} SNode, *SList;
Headless List Operations
Operations on lists without a dummy head node requi ...
Posted on Tue, 25 Aug 2026 16:00:21 +0000 by mraza
C++ String-Based Hexadecimal to Octal Conversion
Problem Specification
Given a set of positive hexadecimal integers, transform each into its octal equivalent. The input provides a count n (1 ≤ n ≤ 10), followed by n strings composed of digits 0-9 and uppercase letters A-F. Each string can be up to 100,000 characters long. Neither the input nor the output should contain leading zeros.
Convers ...
Posted on Mon, 24 Aug 2026 16:48:57 +0000 by Cagecrawler
Converting Between Arabic and Roman Numerals
Understanding Roman Numerals
Roman numerals do not use positional notation. In positional systems, a digit's value depends on both its symbol and its position. Roman numerals can appear in non-sequential order (such as IV for 4), making them non-positional. The system fell out of common use because it lacks a symbol for zero, becomes cumbersome ...
Posted on Mon, 24 Aug 2026 16:36:15 +0000 by marq
Implementing Singly Linked List CRUD Operations in C
Node Structure Definition
A singly linked list is constructed as a sequence of nodes, where each node contains a data field and a pointer to the subsequent node. The following structure defines a node with an integer identifier and a text label.
typedef struct ListNode {
int id;
char description[32];
struct ListNode* next;
} ListNod ...
Posted on Sun, 23 Aug 2026 16:41:43 +0000 by kampbell411
Competitive Programming Contest Solutions and Analysis
Calculating Paths in Dynamic Graphs
To determine the total number of simple paths in a Directed Acyclic Graph (DAG), we analyze the in-degrees and out-degrees. Let $fwd_dp[i]$ be the number of paths ending at node $i$. This can be computed using topological sorting. The total number of paths in the original graph is $\sum fwd_dp[i]$ for all nod ...
Posted on Wed, 19 Aug 2026 16:43:01 +0000 by Niccaman
Solutions for 2020 ICPC Asia Shenyang Regional Contest Problems
Problem D: Journey to Un'Goro
For small sequence lengths (n ≤ 20), iterate through all possible binary strings of length n. For each string, compute the prefix sum of red characters ('r' represented as 1, 'b' as 0). Count the number of subarrays where the sum of reds is odd. Track the maximum count and collect all configurations achieving it.
F ...
Posted on Wed, 19 Aug 2026 16:39:07 +0000 by andreas
ABC311 Contest Solutions
A - First ABC
Solution
We can track the first appearence of each character using boolean flags. By iterating through the string, we can determine the earliest position where all three required characters have been encountered.
#include <iostream>
#include <string>
using namespace std;
int main() {
int length;
string input;
...
Posted on Tue, 18 Aug 2026 16:36:57 +0000 by sysop
Implementing Binary Search with Closed and Half-Open Intervals
Binary search is efficient only under specific conditions: the input array must be sorted and contain unique elements. If duplicates exist, the algorithm might return any one of the matching indices rather than a guaranteed specific one.
A critical concept in binary search is the "loop invariant," which relies on a strict definition o ...
Posted on Mon, 17 Aug 2026 16:24:56 +0000 by konsu
Efficient Substring Searching with the KMP Algorithm
This document outlines the implementation and usage of the Knuth-Morris-Pratt (KMP) algorithm for efficiently finding all occurrences of a pattern string within a larger text string. The algorithm is designed to handle texts and patterns composed of uppercase and lowercase English letters, aswell as Arabic numerals.
Problem Statement
Given a te ...
Posted on Mon, 17 Aug 2026 16:22:36 +0000 by lightningstrike
Backtracking Algorithms for Combinatorial Generation
Generating the complete power set of a collection involves binary decisions at each element. The recursive approach branches twice: once including the current element and once excluding it.
public void enumerateSubsets(int[] data, List<Integer> buffer, int idx) {
if (idx == data.length) {
System.out.println(buffer);
re ...
Posted on Fri, 14 Aug 2026 16:51:09 +0000 by TheHyipSite