Skip to content

jshields/python_academic_examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python academic examples

Work in Progress

Python 2.7

Not meant for practical use; for educational purposes only.

The goal of this repo is to demonstrate concepts, such as what certain alogrithms do, using Python syntax to keep things simple, even though the code will be doing things that don't make sense to do in Python / any real production scenario.

Contents:

basic Object Oriented example

  • Animal ✅
  • Cat ✅
  • Dog ✅
  • Unicode animal emoji methods ✅
  • associated unit tests ✅

algorithms

  • sort
    • Bubble Sort ✅
    • Merge Sort (recursive) ✅
    • Quicksort (Hoare partition scheme) ✅
    • Quicksort (middle pivot) ✅
    • Insertion Sort ✅
    • Selection Sort ✅
  • search
    • Linear Search ✅
    • Binary Search ✅

other:

  • ackermann
  • Fibonacci Sequence (implementations using various approaches)
  • some threading examples.
    • May want to move these out into their own repo demonstrating race conditions

Running unit tests:

unittest CLI:

# all tests
python -m unittest
# individual test
python -m unittest tests.test_fibonacci

sort usage:

from examples.sort.quick import QuickSortMiddlePivot
QuickSortMiddlePivot.quick([2,6,1,7,3,2])

Footnotes:

https://www.hindawi.com/journals/isrn/2012/947634/

About

Python example code. OOP, search / sort algorithms.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published