# greyireland/algorithm-pattern

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/greyireland-algorithm-pattern).**

15,465 stars · 2,582 forks · Go · MIT

## Links

- GitHub: https://github.com/greyireland/algorithm-pattern
- Homepage: https://greyireland.gitbook.io/algorithm-pattern
- awesome-repositories: https://awesome-repositories.com/repository/greyireland-algorithm-pattern.md

## Topics

`algo` `algorithm` `leetcode` `leetcode-go` `pattern`

## Description

This project is an algorithm template library and coding interview study guide providing reusable code patterns for common data structures and algorithms. It serves as a reference for optimized strategies and a structured learning path to build proficiency in algorithmic problem solving and competitive programming.

The library focuses on standardized implementations of key algorithmic patterns, including sliding windows, backtracking, dynamic programming, and binary search. It provides specific templates for managing binary search trees, searching rotated sorted arrays, and executing divide-and-conquer decompositions.

The collection covers a wide range of computer science fundamentals, including the implementation of linked lists, stacks, queues, and hash maps. It includes capabilities for graph traversal using breadth-first and depth-first search, sorting via merge and quick sort, and various bitwise operations.

The project is implemented in Go.

## Tags

### Education & Learning Resources

- [Technical Interview Preparation](https://awesome-repositories.com/f/education-learning-resources/technical-interview-preparation.md) — Serves as a comprehensive guide and template library for mastering technical interview problem patterns. ([source](https://greyireland.gitbook.io/algorithm-pattern/ru-men-pian/quickstart.md))
- [Algorithmic References](https://awesome-repositories.com/f/education-learning-resources/algorithmic-references.md) — Acts as a reference for optimized strategies including sliding windows, backtracking, dynamic programming, and binary search.
- [Computer Science Fundamentals](https://awesome-repositories.com/f/education-learning-resources/computer-science-fundamentals.md) — Offers practical exercises covering core computer science fundamentals, including sorting algorithms, graph traversal, and bitwise operations.
- [Data Structures and Algorithms](https://awesome-repositories.com/f/education-learning-resources/curricula-instructional-design/curricula-roadmaps/foundations-study-skills/foundational-computer-science-modules/data-structures-and-algorithms.md) — Provides implementations and study materials for fundamental data structures including linked lists, stacks, and queues. ([source](https://greyireland.gitbook.io/algorithm-pattern/))
- [Data Structure Implementations](https://awesome-repositories.com/f/education-learning-resources/data-structure-implementations.md) — Implements fundamental data structures such as linked lists, binary trees, stacks, and queues as educational code examples.
- [Depth-First Search Implementations](https://awesome-repositories.com/f/education-learning-resources/depth-first-search-implementations.md) — Provides practical implementations of depth-first search for state space exploration and backtracking.
- [Divide And Conquer Algorithms](https://awesome-repositories.com/f/education-learning-resources/educational-resources/algorithms-theory-academics/cs-theory-foundations/algorithms/algorithmic-paradigms/divide-and-conquer-algorithms.md) — Provides algorithms that decompose complex computational problems into smaller sub-problems to reach a solution.
- [Breadth-First Search](https://awesome-repositories.com/f/education-learning-resources/educational-resources/algorithms-theory-academics/cs-theory-foundations/algorithms/data-ordering-and-retrieval/breadth-first-search.md) — Implements a breadth-first search strategy for traversing tree and graph data structures level by level.
- [Algorithm Implementations](https://awesome-repositories.com/f/education-learning-resources/educational-resources/algorithms-theory-academics/cs-theory-foundations/algorithms/general-collections-and-study/algorithm-implementations.md) — Provides practical code implementations of algorithms and design patterns used to solve computational problems. ([source](https://greyireland.gitbook.io/algorithm-pattern/readme_zh.md))
- [Interview-Focused Problem Sets](https://awesome-repositories.com/f/education-learning-resources/educational-resources/algorithms-theory-academics/cs-theory-foundations/algorithms/general-collections-and-study/algorithmic-problem-sets/interview-focused-problem-sets.md) — Curates a study journey of high-frequency problem sets organized for interview preparation. ([source](https://greyireland.gitbook.io/algorithm-pattern/readme_zh.md))
- [Fundamental Algorithm Study](https://awesome-repositories.com/f/education-learning-resources/fundamental-algorithm-study.md) — Provides a structured learning path for mastering fundamental algorithmic techniques and dynamic programming. ([source](https://greyireland.gitbook.io/algorithm-pattern/))
- [Sliding Window Algorithms](https://awesome-repositories.com/f/education-learning-resources/sliding-window-algorithms.md) — Implements techniques for processing contiguous subarrays or substrings using a moving window of fixed or variable size. ([source](https://greyireland.gitbook.io/algorithm-pattern/suan-fa-si-wei/slide_window.md))
- [Sorting Algorithms](https://awesome-repositories.com/f/education-learning-resources/sorting-algorithms.md) — Implements essential sorting algorithms like quick sort, merge sort, and heap sort for educational study. ([source](https://greyireland.gitbook.io/algorithm-pattern/ji-chu-suan-fa-pian/sort.md))
- [Algorithmic Problem Solving](https://awesome-repositories.com/f/education-learning-resources/technical-domain-education/computer-science-education/algorithmic-problem-solving.md) — Guides the development of algorithmic thinking through the practice of recursion, sliding windows, and tree structures. ([source](https://greyireland.gitbook.io/algorithm-pattern/))
- [Recursive Problem Solving](https://awesome-repositories.com/f/education-learning-resources/technical-domain-education/computer-science-education/algorithmic-problem-solving/recursive-problem-solving.md) — Provides standardized templates for solving problems through recursive decomposition and state transitions. ([source](https://greyireland.gitbook.io/algorithm-pattern/suan-fa-si-wei/recursion.md))
- [Technical Learning Paths](https://awesome-repositories.com/f/education-learning-resources/technical-learning-paths.md) — Provides a structured learning sequence from basic concepts to advanced interview problems. ([source](https://cdn.jsdelivr.net/gh/greyireland/algorithm-pattern@master/README.md))
- [Competitive Programming Training](https://awesome-repositories.com/f/education-learning-resources/competitive-programming-training.md) — Includes structured practice sets and scientific patterns designed to improve speed and accuracy for competitive programming.
- [Queue Simulation Patterns](https://awesome-repositories.com/f/education-learning-resources/data-structure-implementations/stacks/queue-simulation-patterns.md) — Implements stacks and queues using Go slices, including simulating queues via stacks. ([source](https://greyireland.gitbook.io/algorithm-pattern/ru-men-pian/golang.md))
- [Stack-Based Minimum Finders](https://awesome-repositories.com/f/education-learning-resources/educational-resources/algorithms-theory-academics/cs-theory-foundations/algorithms/data-ordering-and-retrieval/minimum-value-finders/stack-based-minimum-finders.md) — Implements a specialized stack that tracks the minimum element in constant time. ([source](https://greyireland.gitbook.io/algorithm-pattern/shu-ju-jie-gou-pian/stack_queue.md))
- [Balance Verification](https://awesome-repositories.com/f/education-learning-resources/educational-resources/algorithms-theory-academics/cs-theory-foundations/data-structure-implementations/data-structures/balanced-search-trees/balance-verification.md) — Implements algorithms to verify if a binary tree satisfies height-balance criteria. ([source](https://greyireland.gitbook.io/algorithm-pattern/suan-fa-si-wei/binary_search_tree.md))
- [Graph Cloning Patterns](https://awesome-repositories.com/f/education-learning-resources/graph-cloning-patterns.md) — Provides a template for deep copying graphs using maps and recursion to handle cyclic references. ([source](https://greyireland.gitbook.io/algorithm-pattern/shu-ju-jie-gou-pian/stack_queue.md))
- [Interview Study Paths](https://awesome-repositories.com/f/education-learning-resources/problem-solving-guides/interview-study-paths.md) — Offers a structured learning path and categorized problem sets to build proficiency in algorithmic problem solving.
- [Stack-Based Queues](https://awesome-repositories.com/f/education-learning-resources/queue-implementations/stack-based-queues.md) — Demonstrates how to simulate first-in-first-out queue behavior using two last-in-first-out stacks. ([source](https://greyireland.gitbook.io/algorithm-pattern/shu-ju-jie-gou-pian/stack_queue.md))
- [Sorted Matrix Search Patterns](https://awesome-repositories.com/f/education-learning-resources/sorted-matrix-search-patterns.md) — Implements efficient search algorithms for 2D matrices by treating sorted rows and columns as a continuous search space. ([source](https://greyireland.gitbook.io/algorithm-pattern/ji-chu-suan-fa-pian/binary_search.md))

### Scientific & Mathematical Computing

- [Algorithmic Templates](https://awesome-repositories.com/f/scientific-mathematical-computing/numerical-mathematical-foundations/algorithms-and-complexity/algorithms/development-and-practice/algorithmic-development-frameworks/algorithmic-templates.md) — Provides a comprehensive library of reusable code patterns to standardize the approach for solving common algorithmic problems. ([source](https://greyireland.gitbook.io/algorithm-pattern/))
- [Binary Search Algorithms](https://awesome-repositories.com/f/scientific-mathematical-computing/binary-search-algorithms.md) — Provides reusable templates for binary search to locate target values or boundaries in sorted arrays. ([source](https://greyireland.gitbook.io/algorithm-pattern/ji-chu-suan-fa-pian/binary_search.md))
- [Interview Templates](https://awesome-repositories.com/f/scientific-mathematical-computing/numerical-mathematical-foundations/algorithms-and-complexity/algorithms/development-and-practice/algorithmic-development-frameworks/algorithmic-templates/interview-templates.md) — Provides a library of reusable code templates for common data structures and algorithms used in technical interviews.
- [Recursive Tree Traversal Algorithms](https://awesome-repositories.com/f/scientific-mathematical-computing/recursive-tree-traversal-algorithms.md) — Provides implementations of pre-order, in-order, and post-order tree traversal sequences. ([source](https://greyireland.gitbook.io/algorithm-pattern/shu-ju-jie-gou-pian/stack_queue.md))
- [Binary Tree Traversals](https://awesome-repositories.com/f/scientific-mathematical-computing/recursive-tree-traversal-algorithms/binary-tree-traversals.md) — Provides recursive and iterative implementations of preorder, inorder, and postorder binary tree traversals. ([source](https://greyireland.gitbook.io/algorithm-pattern/shu-ju-jie-gou-pian/binary_tree.md))
- [Bitwise Manipulation Utilities](https://awesome-repositories.com/f/scientific-mathematical-computing/bitwise-manipulation-utilities.md) — Provides templates for XOR, AND, and shifting patterns to isolate unique elements and count set bits. ([source](https://greyireland.gitbook.io/algorithm-pattern/shu-ju-jie-gou-pian/binary_op.md))
- [Pathfinding Algorithms](https://awesome-repositories.com/f/scientific-mathematical-computing/numerical-mathematical-foundations/algorithms-and-complexity/pathfinding-algorithms.md) — Implements graph traversal and pathfinding algorithms to find optimal paths through grids. ([source](https://greyireland.gitbook.io/algorithm-pattern/ji-chu-suan-fa-pian/dp.md))
- [Rotated Sorted Array Search](https://awesome-repositories.com/f/scientific-mathematical-computing/sorted-array-management/rotated-sorted-array-search.md) — Ships optimized binary search variations for finding elements in rotated sorted arrays. ([source](https://greyireland.gitbook.io/algorithm-pattern/ji-chu-suan-fa-pian/binary_search.md))
- [Sorting Algorithms](https://awesome-repositories.com/f/scientific-mathematical-computing/sorting-algorithms.md) — Implements general-purpose sorting algorithms for organizing various data collections. ([source](https://greyireland.gitbook.io/algorithm-pattern/ru-men-pian/golang.md))

### Software Engineering & Architecture

- [Algorithmic Problem Solving](https://awesome-repositories.com/f/software-engineering-architecture/algorithmic-problem-solving.md) — Provides a comprehensive library of reusable code patterns for mastering data structures and algorithms.
- [Backtracking Algorithms](https://awesome-repositories.com/f/software-engineering-architecture/backtracking-algorithms.md) — Implements algorithms that systematically explore solution spaces by reverting to previous states. ([source](https://greyireland.gitbook.io/algorithm-pattern/suan-fa-si-wei/backtrack.md))
- [Merge Sorts](https://awesome-repositories.com/f/software-engineering-architecture/sorting-algorithms/merge-sorts.md) — Implements sorting algorithms that recursively divide and merge sequences to achieve ordered results. ([source](https://greyireland.gitbook.io/algorithm-pattern/shu-ju-jie-gou-pian/binary_tree.md))
- [Quick Sorts](https://awesome-repositories.com/f/software-engineering-architecture/sorting-algorithms/quick-sorts.md) — Provides pivot-based partitioning algorithms for recursive array sorting. ([source](https://greyireland.gitbook.io/algorithm-pattern/shu-ju-jie-gou-pian/binary_tree.md))
- [Two-Pointer Strategies](https://awesome-repositories.com/f/software-engineering-architecture/two-pointer-strategies.md) — Implements algorithmic patterns using multiple indices to traverse linear data structures in-place.
- [Knapsack Problem Solving](https://awesome-repositories.com/f/software-engineering-architecture/algorithmic-problem-solving/knapsack-problem-solving.md) — Implements knapsack-specific dynamic programming to maximize value within capacity constraints. ([source](https://greyireland.gitbook.io/algorithm-pattern/ji-chu-suan-fa-pian/dp.md))
- [Sequence Optimization](https://awesome-repositories.com/f/software-engineering-architecture/algorithmic-problem-solving/sequence-optimization.md) — Determines optimal values for linear sequences including climbing steps and longest increasing subsequences. ([source](https://greyireland.gitbook.io/algorithm-pattern/ji-chu-suan-fa-pian/dp.md))
- [Cycle Detection Algorithms](https://awesome-repositories.com/f/software-engineering-architecture/cycle-detection-algorithms.md) — Provides algorithms to detect loops and locate cycle starts in linked data structures. ([source](https://greyireland.gitbook.io/algorithm-pattern/shu-ju-jie-gou-pian/linked_list.md))
- [Postfix Expression Evaluators](https://awesome-repositories.com/f/software-engineering-architecture/expression-transformers/notation-converters/postfix-expression-evaluators.md) — Provides a stack-based evaluator for arithmetic expressions in reverse polish notation. ([source](https://greyireland.gitbook.io/algorithm-pattern/shu-ju-jie-gou-pian/stack_queue.md))
- [Deep Copy Routines](https://awesome-repositories.com/f/software-engineering-architecture/linked-lists/deep-copy-routines.md) — Implements routines to create deep copies of linked lists containing random pointers. ([source](https://greyireland.gitbook.io/algorithm-pattern/shu-ju-jie-gou-pian/linked_list.md))
- [Linked List Analysis Utilities](https://awesome-repositories.com/f/software-engineering-architecture/linked-lists/linked-list-analysis-utilities.md) — Provides analysis utilities to verify if a linked list is a palindrome. ([source](https://greyireland.gitbook.io/algorithm-pattern/shu-ju-jie-gou-pian/linked_list.md))
- [Duplicate Node Removal](https://awesome-repositories.com/f/software-engineering-architecture/linked-lists/linked-list-manipulation-utilities/duplicate-node-removal.md) — Provides utilities to remove duplicate elements from sorted linked lists. ([source](https://greyireland.gitbook.io/algorithm-pattern/shu-ju-jie-gou-pian/linked_list.md))
- [Linked List Sorting Algorithms](https://awesome-repositories.com/f/software-engineering-architecture/linked-lists/linked-list-sorting-algorithms.md) — Provides optimized routines for merging two sorted linked lists into a single sorted sequence. ([source](https://greyireland.gitbook.io/algorithm-pattern/shu-ju-jie-gou-pian/linked_list.md))
- [Linked List Topology Transformers](https://awesome-repositories.com/f/software-engineering-architecture/linked-lists/linked-list-topology-transformers.md) — Provides routines for reversing the order of nodes in a linked list or specific sub-sections. ([source](https://greyireland.gitbook.io/algorithm-pattern/shu-ju-jie-gou-pian/linked_list.md))
- [Partitioning Algorithms](https://awesome-repositories.com/f/software-engineering-architecture/linked-lists/partitioning-algorithms.md) — Implements logic to partition linked list nodes around a target value. ([source](https://greyireland.gitbook.io/algorithm-pattern/shu-ju-jie-gou-pian/linked_list.md))
- [Reordering Routines](https://awesome-repositories.com/f/software-engineering-architecture/linked-lists/reordering-routines.md) — Implements complex node rearrangements such as interleaving the first and second halves of a list. ([source](https://greyireland.gitbook.io/algorithm-pattern/shu-ju-jie-gou-pian/linked_list.md))
- [Memoization Caches](https://awesome-repositories.com/f/software-engineering-architecture/memoization-caches.md) — Includes utilities for caching function results to optimize performance and prevent redundant computation in dynamic programming.
- [Repetition-Based String Decoders](https://awesome-repositories.com/f/software-engineering-architecture/string-processing-algorithms/repetitive-string-compression-algorithms/repetition-based-string-decoders.md) — Implements stack-based parsing to decode compressed strings with nested repetition patterns. ([source](https://greyireland.gitbook.io/algorithm-pattern/shu-ju-jie-gou-pian/stack_queue.md))
- [Cycle Detection](https://awesome-repositories.com/f/software-engineering-architecture/two-pointer-strategies/cycle-detection.md) — Uses fast and slow pointer techniques to detect cycles and identify midpoints in linked lists.

### Programming Languages & Runtimes

- [Binary Search Trees](https://awesome-repositories.com/f/programming-languages-runtimes/programming-utilities/data-structure-type-helpers/data-structures/hierarchical-tree-structures/binary-search-trees.md) — Implements binary search tree operations including node insertion, deletion, and structural validation. ([source](https://greyireland.gitbook.io/algorithm-pattern/suan-fa-si-wei/binary_search_tree.md))
- [Array Element Finding](https://awesome-repositories.com/f/programming-languages-runtimes/programming-utilities/data-structure-type-helpers/data-type-utilities/array-element-finding.md) — Implements logic to locate the first instance of a condition change within a sequence. ([source](https://greyireland.gitbook.io/algorithm-pattern/ji-chu-suan-fa-pian/binary_search.md))

### Data & Databases

- [Key-Value Pair Managers](https://awesome-repositories.com/f/data-databases/key-value-pair-managers.md) — Provides templates for managing key-value mappings including deletion and iteration. ([source](https://greyireland.gitbook.io/algorithm-pattern/ru-men-pian/golang.md))

### Development Tools & Productivity

- [Competitive Programming Repositories](https://awesome-repositories.com/f/development-tools-productivity/competitive-programming-repositories.md) — Organizes source code collections by problem category and algorithm type for competitive programming reference.
