Working with Python Lists and Tuples

A list is an ordered, mutable collection that can hold elements of any type, including other lists. Creating Lists Lists can be created through direct definition, for loops, and list comprehensions. Direct Definition Use square brackets []. sample_list = [1, 2, 'hello', [3, 4], (5,), {'data': 100}] Using a For Loop num_list = [] for j in range ...

Posted on Fri, 02 Oct 2026 16:10:08 +0000 by leap500

Redis Lists, Sets, and Sorted Sets: Internal Layout and Practical Patterns

Redis List Storage Semantics A Redis List is an ordered sequence of strings that preserves insertion order and allows duplicates. The theoretical upper bound is 2³²-1 (~4 billion) entries. Core Commands # Left-push elements lpush inbox msg1 lpush inbox msg2 msg3 lpush inbox msg4 msg5 # Left-pop elements lpop inbox lpop inbox # Random access l ...

Posted on Fri, 02 Oct 2026 16:04:42 +0000 by Hybrid Kill3r

Implementation of the Chtholly Tree Data Structure

The Chtholly Tree organizes consecutive array segments with identical values into nodes, stored in a sorted set. Each node represents a range [l, r] with a mutable value. struct Segment { int left, right; mutable long long value; Segment(int l = 0, int r = 0, long long v = 0) : left(l), right(r), value(v) {} bool operator<(co ...

Posted on Thu, 01 Oct 2026 16:29:25 +0000 by ryankentp

Replacing Words with Their Shortest Root Prefix

Problem Description In English, there exists a concept called root which can be combined with other words to form longer words called successors. To example, the root "an" combined with "other" forms the word "another". Given a dictionary of roots and a sentence, replace all successor words in the sentence with the ...

Posted on Thu, 01 Oct 2026 16:10:25 +0000 by sgalatas

Fundamental Algorithms and Data Structures for Problem Solving

Sorting Techniques Bubble Sort Implementation class Solution { public: void sortColors(vector<int>& arr) { performBubbleSort(arr); } private: void performBubbleSort(vector<int>& data) { int length = data.size(); for(int i = 0; i < length - 1; i++) { for(int j = 0; j &lt ...

Posted on Mon, 28 Sep 2026 16:25:39 +0000 by lehara

Singly Linked List Implementation and Operations

Structure Definition A singly linked list is a linear data structure where elements are stored in nodes that are logically connected but physically dispersed in memory. Each node contains data and a pointer to the next node in the sequence. typedef int DataType; typedef struct Node { DataType value; struct Node* next; } ListNode; In th ...

Posted on Sun, 27 Sep 2026 16:24:01 +0000 by gurroa

Understanding Structs in Rust Programming

Defining Structs in Rust #[derive(Debug)] struct UserProfile { username: String, dimensions: u32, length: u32, } Implementing Struct Methods impl UserProfile { // Instance method fn calculate_area(&self) -> u32 { self.dimensions * self.length } // Method with multiple parameters fn is_larger ...

Posted on Sat, 26 Sep 2026 16:42:36 +0000 by mattcooper

Implementing Sequential Lists and Linked Lists in C

Linear Lists A linear list is a finite sequence of n data elements sharing the same characteristics. It serves as a widely used data structure in practice, with common implementations including sequential lists, linked lists, stacks, queues, and strings. Logically, a linear list maintains a linear structure resembling a continuous line. However ...

Posted on Sat, 26 Sep 2026 16:28:14 +0000 by nanny79

Classic Binary Tree Algorithms and Solutions

Non-Recursive Implementation of Preorder, Inorder, and Postorder Traversals The three traversal methods—preorder, inorder, and postorder—form the foundation for all tree-related problems. Preorder Traversal Algorithm: Create an empty stack and push the root node onto it. While the stack is not empty: Pop a node from the stack and process it ( ...

Posted on Tue, 22 Sep 2026 16:22:07 +0000 by mbaroz

Mastering R Lists: Creation, Manipulation, and Advanced Usage

Understanding the List Container in R The list stands out as one of the most flexible data structures in the R ecosystem. Unlike atomic vectors that require homogeneous elements, lists can store heterogeneous objects simultaneously, including vectors, matrices, data frames, functions, or even other lists. This capability makes them indispensabl ...

Posted on Tue, 22 Sep 2026 16:15:59 +0000 by bradymills