A small, growing collection of simple Python Algorithms.
Contents:
- gcd.py
- fibonacci.py
- fibonacci2.py
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.
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.
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.
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!