Skip to content

theo-xiao-sg/algorithms_python

Repository files navigation

Other python algorithms

These are a few python algorithms made with python. These include:

  • A code to compare the speed of two methods to find the square root of a large number, binary search and linear search (square_root.py)
  • A code to achieve binary search implementation using recursive algorithm (binary_search_recursive.py)
  • A code to implement quick sort algorithm using recursive method (quick_sort.py)
  • A code to implement insert sort algorithm (insert_sort.py)
  • A code to implement selection sort algorithm (selection_sort.py)
  • A code to implement bubble sort algorithm (bubble_sort.py)
  • A code to calculate the factorial of a number (factorial.py)
  • A code to calculate the greatest common divisor(GCD) of a number using recursive algorithm (gcd_recursive.py)
  • A code to calculate the greatest common divisor(GCD) of a number (gcd.py)
  • A code to calculate the least common multiplier(LCM) of a number (lcm.py)
  • A code to find out if the number is a palindrome number (palindrome_number.py)

Running Guide

This project is based on the Python programming language and primarily utilizes standard libraries like time.

Environment Setup

Download the requirements.txt and install the required Python libraries. Please note all my 4 projects share the same requirements.txt. If you have done the installation for one project, you can skip it for the other 3 projects

# install all packages using requirements.txt
python -m pip install -r requirements.txt

Trying it out

You can try out the code and also mess with the parameters and test out different combinations. I hope you will enjoy messing with the code!