Use the last element as the first pivot, for it's easy to pop, this saves one element space.
Iterating with the original list saves half the space, instead of generate a new shallow copy list by slice method.
I've added comments to make understanding this method a little easier for those that are not familiar. This should close out #727 .
Other changes:
1. added if __name__ == '__main__' rather than the "# MAIN" comment
2. put in return for distances and vertices. Previously everything was just printed out, but someone may find it useful to have the algorithm return something.
3. Other PEP8 changes
4. Added example input and expected output as a check to make sure any future changes will give the same output.
* Added print function into matrix_multiplication_addition.py and removed blank space in data_structures/binary tree directory
* Removed .vs/ folder per #893
* Rename matrix_multiplication_addition.py to matrix_operation.py
* iterative and formula fibonacci methods
Added two ways to calculate the fibonacci sequence: (1) iterative (2) formula.
I've also added a timer decorator so someone can see the difference in computation time between these two methods.
Added two unittests using the slash framework.
* Update test_fibonacci.py
* remove inline comments per Contributing Guidelines
* Update sol5.py
* Create placeholder.py
* Update and rename maths/test_fibonacci.py to maths/tests/test_fibonacci.py
* Delete placeholder.py
* Create __init__.py
* Update test_fibonacci.py
* Rename Maths/lucasSeries.py to maths/lucasSeries.py
* Update and rename Project Euler/Problem 01/sol5.py to project_euler/problem_01/sol6.py
* -Added a single-threaded implementation of odd-even transposition sort.
This is a modified bubble sort meant to work with multiple processors.
Since this is running on a single thread, it has the same running time
as bubble sort.
* -Added a parallel implementation of Odd-Even Transposition sort
This implementation uses multiprocessing to perform the swaps
at each step of the algorithm simultaneously.
* Atbash.py: Both raw_input() and unichr() were removed in Python 3
@sateslayer and @AnupKumarPanwar your reviews please.
* Remove any leading / trailing whitespace from user input
* subset_generation
generate all possible subset of size n of a given array of size r
* Rename subset_generation to subset_generation.py
* Update subset_generation.py
I made all changes I could . What I mean is I removed all the empty space .......
There some comment extra if you feel removing those comments please do so yourself pls provide spacing as it should be
* Create morse_Code_implementation.py
* Any more changes pls let me know
* Adding variable to fade out ambiguity
* More readability on merge sorting algorithm
* Updating merge_sort_fastest description and explaining why
* Adding tests file with imports
* Standardazing filenames and function names
* Adding test cases and test functions
* Adding test loop
* Putting 'user oriented code' inside main condition for having valid imports
* Fixing condition
* Updating tests: adding cases and todo list
* Refactoring first euler problem's first solution
* fix endless loop bug, divide 0 bug and update description
fix an endless bug, for example, if collection = [10,30,40,45,50,66,77,93], item = 67.
fix divide 0 bug, when right=left it is not OK to point = left + ((item - sorted_collection[left]) * (right - left)) // (sorted_collection[right] - sorted_collection[left])
update 'sorted' to 'ascending sorted' in description to avoid confusion
* delete swap files
* delete 'address' and add input validation
* Travis CI: Add more flake8 tests
* Use ==/!= to compare str, bytes, and int literals
./project_euler/problem_17/sol1.py:25:7: F632 use ==/!= to compare str, bytes, and int literals
if i%100 is not 0:
^
* Use ==/!= to compare str, bytes, and int literals
* Update sol1.py