2018-10-05 07:09:34 +00:00
|
|
|
# Algorithms
|
|
|
|
|
|
|
|
This repository is meant for me to compile a list of examples of different
|
|
|
|
algorithms that I have learned of, and develop a working implementation.
|
|
|
|
These implementations may not be the most efficient, so please do point it
|
2018-10-06 04:43:33 +00:00
|
|
|
out to me if you see something that could be improved upon. The complexity
|
|
|
|
notations were taken from the [Big O Cheatsheet](http://bigocheatsheet.com/)
|
2018-10-05 07:20:16 +00:00
|
|
|
|
2018-10-06 04:43:33 +00:00
|
|
|
### Sorting
|
2018-10-05 07:20:16 +00:00
|
|
|
|
2018-10-06 04:43:33 +00:00
|
|
|
Algorithm|Implementation|Tests|Worst Time Complexity|Worst Space Complexity
|
|
|
|
-----|-----|-----|-----|-----
|
2018-10-06 05:03:28 +00:00
|
|
|
[Bubble Sort](https://en.wikipedia.org/wiki/Bubble_sort)|[BubbleSort.java](sorting/src/main/java/com/wbrawner/algorithms/sorting/BubbleSort.java)|[ParameterizedBubbleSortTest.java](sorting/src/test/java/com/wbrawner/algorithms/sorting/ParameterizedBubbleSortTest.java)|O(n²)|O(1)
|
2018-10-06 04:43:33 +00:00
|
|
|
[Insertion Sort](https://en.wikipedia.org/wiki/Insertion_sort)|[InsertionSort.java](sorting/src/main/java/com/wbrawner/algorithms/sorting/InsertionSort.java)|[ParameterizedInsertionSortTest.java](sorting/src/test/java/com/wbrawner/algorithms/sorting/ParameterizedInsertionSortTest.java)|O(n²)|O(1)
|
|
|
|
[Merge Sort](https://en.wikipedia.org/wiki/Merge_sort)|[MergeSort.java](sorting/src/main/java/com/wbrawner/algorithms/sorting/MergeSort.java)|[ParameterizedMergeSortTest.java](sorting/src/test/java/com/wbrawner/algorithms/sorting/ParameterizedMergeSortTest.java)|O(n log(n))|O(n)
|
2018-10-05 07:20:16 +00:00
|
|
|
|
|
|
|
## Building/Testing
|
|
|
|
|
|
|
|
./gradlew test
|
|
|
|
|
|
|
|
To keep things simple, the tests share the same data where possible.
|
|
|
|
|
2018-10-06 04:43:33 +00:00
|
|
|
- [Sorting algorithms test data](sorting/src/test/java/com/wbrawner/algorithms/sorting/SortData.java)
|