Skip to content

Algorithms Overview

This section contains comprehensive documentation for all algorithms implemented in the algo-py library.

Available Algorithms

Sorting

Simple Sorting

  • Bubble Sort: Simple comparison-based algorithm with O(n²) complexity
  • Selection Sort: Finds minimum element and places it at the beginning
  • Insertion Sort: Builds sorted array one element at a time

Efficient Comparison-Based Sorts

  • Merge Sort: Divide-and-conquer algorithm with guaranteed O(n log n) performance
  • Quick Sort: Fast average-case O(n log n) with in-place partitioning
  • Heap Sort: Uses binary heap data structure for O(n log n) performance

Non-Comparison Based Sorts

  • Counting Sort: Linear time sorting for integers in a known range
  • Radix Sort: Sorts integers by processing individual digits

Searching

Hashing

  • Hash Functions: Various hash function implementations for different use cases

Graph Algorithms

String Algorithms

  • Autocomplete: Text completion using various data structures and strategies
  • Edit Distance: Computing minimum edit distance between strings
  • Longest Repeated Substring (LRS): Finding the longest substring that appears multiple times in a text
  • Longest Common Substring (LCS): Finding the longest substring shared between two strings
  • Palindrome Detection: Multiple approaches for detecting palindromes

Dynamic Programming

  • Fibonacci: Multiple implementations including recursive, memoized, tabulated, space-optimized, and matrix exponentiation approaches

Algorithms Features

Each algorithm implementation includes:

  • Multiple implementation approaches where applicable
  • Time and space complexity analysis
  • Performance comparisons
  • Practical use cases and examples