Category Archives: Learnings

Math & Python – Level 1A

Simultaneous learning : New Textbook.“Curiosity about mathematics,the foundation of everything in the AI era.” Level 1A. : Introduction Python.From the world of integers to simultaneousequations and factorization…. Two free downloadable files : Hands-On Math with Python・Efficient learning with Colab note files linked to this book.・Beginner-friendly Python code explained step-by-step.FilesStart Instantly in Your Browser—No Setup! Table of ContentsChapter 1… Read More »

Euclidean Algorithm

simple algorithm The Euclidean algorithm is a classical method for computing the greatest common divisor (GCD) of two non‑negative integers.The key idea is based on the following property: For any integers a and b (with a ≥ b), the GCD of a and b is the same as the GCD of b and a mod b. Because the remainder becomes strictly smaller each step, the process terminates after only a few iterations, even… Read More »

Depth‑First Search (DFS) Classic AI Algorithms

Simple Python Example The code below shows a recursive DFS on an undirected graph represented as an adjacency list.Vertices are numbered starting from 0. Expected output Iterative (stack‑based) version If you prefer an explicit stack (e.g., to avoid Python’s recursion limit), here’s a compact iterative version: Both implementations produce the same visitation order; choose the style that best… Read More »

Trigonometric Functions

Lengths and ratios of right-angled triangles (Basic knowledge) Trigonometric functions (sin, cos, tan, etc.) are frequently used in machine learning as tools to effectively work with angles, periods, rotations, and positions. Once the angles of a right triangle are determined, the ratio is also determined. Commercially available set squares have well-known trigonometric ratios. As shown in the figure, the… Read More »

Merge Sort (basic algorithm)

Merge sort is an efficient sorting algorithm based on the divide-and-conquer paradigm. It recursively divides a large array into smaller sub-arrays, sorts those sub-arrays, and then merges them back together to create the final sorted array. Features: Algorithm Steps Example Let’s look at the process of sorting the array [8, 3, 1, 7, 0, 10, 2] using merge sort. Python… Read More »

Levenshtein distance(Basic algorithm)

The Levenshtein distance (also known as edit distance) is a metric for measuring the similarity between two strings. It’s defined as the minimum number of operations required to transform one string into the other using insertion, deletion, and substitution operations. We can efficiently calculate the Levenshtein distance using dynamic programming. Example: Levenshtein Distance between “kitten” and “sitting” Let’s… Read More »

Quicksort (Basic Algorithm)

Quicksort is an efficient sorting algorithm based on the divide-and-conquer paradigm. It works as follows: Example of Quicksort: Let’s consider sorting the following array [5, 2, 8, 1, 9, 4, 7]. Python Code Example Quicksort Characteristics: Pivot Selection Strategies: The choice of pivot significantly impacts Quicksort’s performance. Quicksort is widely used due to its relatively simple implementation and speed.… Read More »

Bubble Sort (Basic algorithm)

Bubble sort is one of the simplest sorting algorithms. It works by repeatedly stepping through the list, comparing adjacent elements and swapping them if they are in the wrong order. Larger elements “bubble” to the end of the list with each pass. This process continues until the entire list is sorted in ascending (or descending) order. Example: Let’s… Read More »