Blog
In-depth articles on AI agents, LLM engineering, servers, Python and software development.
This article introduces the fundamental importance of sorting and focuses on two simple sorting algorithms: Insertion Sort and Bubble Sort. Insertion Sort works by gradually building a sorted seque
This article introduces the binary search algorithm, whose core is to compare the middle element in an ordered array to gradually narrow down the search range and quickly locate the target. It is suit
An adjacency matrix is a fundamental representation of a graph, essentially an n×n two-dimensional array where rows and columns correspond to the vertices of the graph, and element values indicate the
Union-Find (Disjoint Set Union, DSU) is an efficient data structure for managing element groups, primarily solving the "Union" (merge groups) and "Find" (check if elements belong to the same group) pr
The prefix sum array is an auxiliary array used to quickly calculate the sum of intervals. It is defined as follows: for the original array A, the prefix sum array S has S[0] = 0, and for k ≥ 1, S[k]
The Fibonacci sequence is defined as f(0) = 0, f(1) = 1, and for n > 1, f(n) = f(n-1) + f(n-2). When calculated directly with recursion, the time complexity is O(2^n) due to excessive repeated computa
Binary Search Trees (BST) may degenerate into linked lists due to extreme insertions, causing operation complexity to rise to O(n). Balanced binary trees control balance through the **balance factor**
A graph consists of vertices (nodes) and edges (connections). Vertices are the basic units, and edges can be directed (digraph) or undirected. Weighted graphs have edges with weights (e.g., distances)
A heap is a special type of complete binary tree, characterized by the size relationship between parent and child nodes (parent ≤ child for a min-heap, parent ≥ child for a max-heap). It efficiently r
Greedy algorithm is an algorithm that makes the optimal choice (local optimum) at each step in the hope of achieving a global optimum. Its core is to satisfy the "greedy choice property"—that the loca