    Skip to content

      Navigation Menu

            Sign in Appearance settings
                * Platform
                        + AI CODE CREATION
                            o GitHub Copilot Write better code with AI
                            o GitHub Copilot app Direct agents from issue to merge
                            o MCP Registry Integrate external tools
                        + DEVELOPER WORKFLOWS
                            o Actions Automate any workflow
                            o Codespaces Instant dev environments
                            o Issues Plan and track work
                            o Code Review Manage code changes
                            o Code Quality Enforce quality at merge
                        + APPLICATION SECURITY
                            o GitHub Advanced Security Find and fix vulnerabilities
                            o Code security Secure your code as you build
                            o Secret protection Stop leaks before they start
                        + EXPLORE
                            o Why GitHub
                            o Documentation
                            o Blog
                            o Changelog
                            o Marketplace
                      View all features
                * Solutions
                        + BY COMPANY SIZE
                            o Enterprises
                            o Small and medium teams
                            o Startups
                            o Nonprofits
                        + BY USE CASE
                            o App Modernization
                            o DevSecOps
                            o DevOps
                            o CI/CD
                            o View all use cases
                        + BY INDUSTRY
                            o Healthcare
                            o Financial services
                            o Manufacturing
                            o Government
                            o View all industries
                      View all solutions
                * Resources
                        + EXPLORE BY TOPIC
                            o AI
                            o Software Development
                            o DevOps
                            o Security
                            o View all topics
                        + EXPLORE BY TYPE
                            o Customer stories
                            o Events & webinars
                            o Ebooks & reports
                            o Business insights
                            o GitHub Skills
                        + SUPPORT & SERVICES
                            o Documentation
                            o Customer support
                            o Community forum
                            o Trust center
                            o Partners
                      View all resources
                * Open Source
                        + COMMUNITY
                            o GitHub Sponsors Fund open source developers
                        + PROGRAMS
                            o Security Lab
                            o Maintainer Community
                            o Accelerator
                            o GitHub Stars
                            o Archive Program
                        + REPOSITORIES
                            o Topics
                            o Trending
                            o Collections
                * Enterprise
                        + ENTERPRISE SOLUTIONS
                            o Enterprise platform AI-powered developer platform
                        + AVAILABLE ADD-ONS
                            o GitHub Advanced Security Enterprise-grade security features
                            o Copilot for Business Enterprise-grade AI features
                            o Premium Support Enterprise-grade 24/7 support
              * Pricing
                Type / to search
                Sign in
              Sign up Appearance settings
      You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

              Uh oh!

              There was an error while loading. Please reload this page.

              TheAlgorithms / Python Public

                      * Uh oh!

                        There was an error while loading. Please reload this page.

              * Notifications You must be signed in to change notification settings
              * Fork 51k
                * Star 224k
          * Code
          * Issues 143
          * Pull requests 882
          * Discussions
          * Actions
          * Projects
          * Wiki
          * Security and quality 0
          * Insights
          Additional navigation options
                  * Code
                  * Issues
                  * Pull requests
                  * Discussions
                  * Actions
                  * Projects
                  * Wiki
                  * Security and quality
                  * Insights
                                              master
                                          Branches Tags
                                            Go to file
                                        Code
                                          Open more actions menu

                                        Folders and files

                                          Name                              Name                                Last commit message    Last commit date
                                            Latest commit                 
                                                                          
                                                History                   
                                                                          
                                                3,670 Commits             
                                                  3,670 Commits           
                                                  .devcontainer                     .devcontainer                                                      
                                                  .github                           .github                                                            
                                                  .vscode                           .vscode                                                            
                                                  audio_filters                     audio_filters                                                      
                                                  backtracking                      backtracking                                                       
                                                  bit_manipulation                  bit_manipulation                                                   
                                                  blockchain                        blockchain                                                         
                                                  boolean_algebra                   boolean_algebra                                                    
                                                  cellular_automata                 cellular_automata                                                  
                                                  ciphers                           ciphers                                                            
                                                  computer_vision                   computer_vision                                                    
                                                  conversions                       conversions                                                        
                                                  data_compression                  data_compression                                                   
                                                  data_structures                   data_structures                                                    
                                                  digital_image_processing          digital_image_processing                                           
                                                  divide_and_conquer                divide_and_conquer                                                 
                                                  docs                              docs                                                               
                                                  dynamic_programming               dynamic_programming                                                
                                                  electronics                       electronics                                                        
                                                  file_transfer                     file_transfer                                                      
                                                  financial                         financial                                                          
                                                  fractals                          fractals                                                           
                                                  fuzzy_logic                       fuzzy_logic                                                        
                                                  genetic_algorithm                 genetic_algorithm                                                  
                                                  geodesy                           geodesy                                                            
                                                  geometry                          geometry                                                           
                                                  graphics                          graphics                                                           
                                                  graphs                            graphs                                                             
                                                  greedy_methods                    greedy_methods                                                     
                                                  hashes                            hashes                                                             
                                                  knapsack                          knapsack                                                           
                                                  linear_algebra                    linear_algebra                                                     
                                                  linear_programming                linear_programming                                                 
                                                  machine_learning                  machine_learning                                                   
                                                  maths                             maths                                                              
                                                  matrix                            matrix                                                             
                                                  networking_flow                   networking_flow                                                    
                                                  neural_network                    neural_network                                                     
                                                  other                             other                                                              
                                                  physics                           physics                                                            
                                                  project_euler                     project_euler                                                      
                                                  quantum                           quantum                                                            
                                                  scheduling                        scheduling                                                         
                                                  scripts                           scripts                                                            
                                                  searches                          searches                                                           
                                                  sorts                             sorts                                                              
                                                  strings                           strings                                                            
                                                  web_programming                   web_programming                                                    
                                                  .gitattributes                    .gitattributes                                                     
                                                  .gitignore                        .gitignore                                                         
                                                  .gitpod.yml                       .gitpod.yml                                                        
                                                  .pre-commit-config.yaml           .pre-commit-config.yaml                                            
                                                  CONTRIBUTING.md                   CONTRIBUTING.md                                                    
                                                  DIRECTORY.md                      DIRECTORY.md                                                       
                                                  LICENSE.md                        LICENSE.md                                                         
                                                  README.md                         README.md                                                          
                                                  index.md                          index.md                                                           
                                                  pyproject.toml                    pyproject.toml                                                     
                                                  uv.lock                           uv.lock                                                            
                                            View all files                
                                          

                                              Repository files navigation

                                                * 
                                                * README
                                                * Code of conduct
                                                * Contributing
                                                * MIT license
                                                More items

                                                  The Algorithms - Python


                                                  All algorithms implemented in Python - for education 📚

                                              Implementations are for learning purposes only. They may be less efficient than the implementations in the Python standard library. Use them at your discretion.

                                                🚀 Getting Started

                                              📋 Read through our Contribution Guidelines before you contribute.

                                                🌐 Community Channels

                                              We are on Discord and Gitter! Community channels are a great way for you to ask questions and get help. Please join us!

                                                📜 List of Algorithms

                                              See our directory for easier navigation and a better overview of the project.

                                        About

                                        All Algorithms implemented in Python

                                          thealgorithms.github.io/Python/

                                        Topics

                                          algorithmalgorithm-competitionsalgorithms-implementedalgoscommunity-driveneducationhacktoberfestinterviewlearnpracticepythonsearchessorting-algorithmssorts

                                        Resources

                                          Readme
                                          MIT license

                                        Code of conduct

                                          Code of conduct

                                        Contributing

                                          Contributing
                                          Activity
                                          Custom properties

                                        Stars

                                          223.6k stars

                                        Watchers

                                          6.0k watching

                                        Forks

                                          51.0k forks
                                          Report repository

                                        Releases

                                        Sponsor this project

                                        Packages

                                        Used by

                                        Contributors

                                        Languages

    Footer

        © 2026 GitHub, Inc.

      Footer navigation

        * Terms
        * Privacy
        * Security
        * Status
        * Community
        * Docs
        * Contact
        * Manage cookies
        * Do not share my personal information
      You can’t perform that action at this time.