Skip to content

densekernel/PythonAlgorithms

Repository files navigation

PythonAlgorithms

A small, growing collection of simple Python Algorithms.

Contents:

  1. gcd.py
  2. fibonacci.py
  3. fibonacci2.py

gcd.py - Greatest Common Divisor Algorithm

Returns and prints the Greatest Common Divisor of two Integers.

  • To run, within the containing directory, type: 'python gcd.py'.
  • The input integers can be manipulated within the source code.

fibonacci.py

Returns the nth value of the fibonacci sequence; by definition, the first two values are 0 and 1. The following values (n) within the sequence are a summation of the previous two values (n-1) + (n-2).

  • To run, within the containing directory, type: 'python fibonacci.py'
  • The input is coded within the file where they can be edited.
  • Examples return the 5th and 7th values of the sequence.

fibonacci2.py

Another fibonacci algorithm with improved efficiency.

  • The input is coded within the file where they can be edited.
  • Examples return the 5th and 53rd values of the sequence.

Credits

UCL Computer Science COMP1002:Theory I covered various algorithms and provided example sample psuedocode. Initial created by Jonny Manfield. Please feel free to help form a small library of Python Algorithms!

About

A small, growing collection of simple Python Algorithms.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages