YiSu Grain
Author

YiSu Grain

A fleeting mayfly in the world, a single grain in the boundless sea.

83
Articles
0
Likes
227
Views
0
Comments
Recent Articles

Latest from YiSu Grain

83 recent articles
YiSu Grain
YiSu Grain
Oct 25, 2024 · Fundamentals

Understanding Treap: A Balanced Tree Explained

This article explains the treap data structure, detailing how each node stores a key and a priority to satisfy both binary‑search‑tree ordering and heap ordering, and walks through insertion, rotation, deletion, and a full Python implementation with concrete examples.

HeapPythonTreap
0 likes · 14 min read
Understanding Treap: A Balanced Tree Explained
YiSu Grain
YiSu Grain
Oct 23, 2024 · Fundamentals

Understanding Fenwick Tree: A Step‑by‑Step Guide

This article explains how a Fenwick (Binary Indexed) Tree stores prefix sums using binary representations and the least‑significant‑bit trick, shows concrete examples for computing sums of sub‑arrays, and provides a full Python implementation with update and query operations.

Binary Indexed TreeFenwick treePrefix Sum
0 likes · 9 min read
Understanding Fenwick Tree: A Step‑by‑Step Guide
YiSu Grain
YiSu Grain
Oct 22, 2024 · Fundamentals

How Segment Trees Enable Lightning‑Fast Range Sum Queries

This article explains the segment tree data structure, showing how to build it both bottom‑up and recursively, how node indexing works, and how the query algorithm skips irrelevant intervals to compute range sums in logarithmic time, complete with Python code examples and performance tips.

Pythonbinary treebottom‑up construction
0 likes · 18 min read
How Segment Trees Enable Lightning‑Fast Range Sum Queries
YiSu Grain
YiSu Grain
Oct 21, 2024 · Fundamentals

Designing an Intelligent Travel Planner with Dijkstra’s Algorithm to Boost Trip Efficiency

This article walks through the design of an intelligent travel‑planning system that uses Dijkstra’s algorithm to compute the minimum travel cost to each city while maximizing the number of cities visited, detailing problem formulation, algorithmic steps, variable initialization, edge‑relaxation logic, and a full Python implementation.

DijkstraPythongraph algorithm
0 likes · 18 min read
Designing an Intelligent Travel Planner with Dijkstra’s Algorithm to Boost Trip Efficiency
YiSu Grain
YiSu Grain
Oct 19, 2024 · Fundamentals

How Heap and Recursion Can Select the Best Tourist Attractions

The article explains how to use a max‑heap together with backtracking and a greedy strategy in Python to recommend the top three attractions with the highest scores while keeping the total travel distance under 20 km, and discusses the algorithm's steps, example execution, and limitations.

HeapPythonbacktracking
0 likes · 12 min read
How Heap and Recursion Can Select the Best Tourist Attractions
YiSu Grain
YiSu Grain
Oct 17, 2024 · Fundamentals

Exploring Shortest Path: A Dijkstra Adventure

This article walks through the problem of finding the shortest route in a smart‑traffic graph, explains Dijkstra's greedy algorithm step by step, illustrates the process with a narrative example, and provides complete Python code using heapq for priority‑queue management.

DijkstraGraph AlgorithmsHeapq
0 likes · 30 min read
Exploring Shortest Path: A Dijkstra Adventure
YiSu Grain
YiSu Grain
Oct 16, 2024 · Fundamentals

How to Build a Greenhouse Auto‑Control System in Python

This article walks through implementing a greenhouse automatic control system in Python, using a deque to store temperature‑humidity readings, defining a GreenhouseControlSystem class with methods for adding data, checking thresholds, and simulating the process, and explains the design choices.

OOPPythondeque
0 likes · 5 min read
How to Build a Greenhouse Auto‑Control System in Python
YiSu Grain
YiSu Grain
Oct 16, 2024 · Fundamentals

Understanding BFS Without Any Coding Experience

This article explains the breadth‑first search algorithm step by step, modeling a 0/1 grid as a graph, showing how a queue and a visited set work, and providing a complete Python implementation that finds the shortest path in a maze.

BFSBreadth-First SearchPathfinding
0 likes · 12 min read
Understanding BFS Without Any Coding Experience
YiSu Grain
YiSu Grain
Oct 15, 2024 · Fundamentals

Master Python Data Structures One by One: Lists, Stacks, Queues, Linked Lists, Trees, Heaps, and Graphs

This comprehensive guide walks you through Python's core data structures—including lists, stacks, queues, linked lists, trees, heaps, and graphs—explaining their characteristics, common operations, and step‑by‑step code examples, while also covering related algorithms such as recursion, depth‑first and breadth‑first search, cycle detection, and Dijkstra's shortest‑path algorithm.

AlgorithmsGraphPython
0 likes · 77 min read
Master Python Data Structures One by One: Lists, Stacks, Queues, Linked Lists, Trees, Heaps, and Graphs
YiSu Grain
YiSu Grain
Oct 11, 2024 · Artificial Intelligence

How to Build and Visualize Polynomial Regression in Python

This article walks through loading CSV data, fitting both linear and degree‑6 polynomial regression models with scikit‑learn, and visualizing the original points, fitted lines, and predictions on test data using matplotlib.

Data VisualizationLinear RegressionPolynomial Regression
0 likes · 5 min read
How to Build and Visualize Polynomial Regression in Python