Skip to content

yuzyayvri/algorithms

Repository files navigation

Yuzy's Algorithms Collection v0.8.0

A collection of my algorithm implementations for learning and reference. Learned and written personally. This is sort of a journey showcasing my improvement in Python. Also— these algorithms can be reused.

Note: There is more information about the algorithms in their docstrings, so check that out if you want to learn more. This documentation only provides a brief and very oversimplified rundown!

Implemented Algorithms

Sorting

  • Bubble Sort - An extremely basic algorithm. Sorts by comparing adjacent elements— though I personally don't recommend this.
  • Selection Sort - A very simple sorting algorithm. Sorts by finding the minimum element and swaps it with the current one.
  • Merge Sort - A simple divide-and-conquer sorting algorithm. Sorts by recursively splitting the list in half down to one element, then merges those sublists back together in sorted order.
  • Insertion Sort - A slide and drop sorting algorithm. Sorts by sliding larger elements to the right until it finds a smaller element to make a 'hole' for a 'key'.
  • Quick Sort - A divide-and-conquer algorithm. Sorts by choosing a pivot and arranging the elements accordingly around that pivot.

Searching

  • Linear Search - A really, really simple searching algorithm. Searches by looping through an array and checking if the element matches the target.
  • Binary Search - An efficient and easy searching algorithm. Searches by cutting the search space in the array in half until it finds the target.

Graph Traversal

  • Depth-First Search - A stack-based graph traversal algorithm that aims to go as deep as possible into one branch before backtracking and exploring other nodes.
  • Breadth-First Search - A queue-based graph traversal algorithm that aims to explore all neighbors of a node before moving to the next level.

Usage

Import and use my algorithms directly:

from merge_sort import merge_sort
result = merge_sort([4, 2, 1, 5, 3])

For more detailed information, there are docstrings included in each algorithm file.

Coming Soon

  • Heap Sort
  • Dijkstra's Algorithm
  • Dynamic Programming
  • And many, many more!

Python 3.11.9

About

A repository for all of my algorithms, learned and written personally. These are libraries and are reusable! Not really much else to say. Feel free to use them, though!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages