algorithms/README.md

34 lines
3.3 KiB
Markdown
Raw Permalink Normal View History

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
2018-10-13 16:01:27 +00:00
notations were taken primarily from the [Big O Cheat Sheet](http://bigocheatsheet.com/)
2018-10-13 15:43:47 +00:00
### Searching
Algorithm|Implementation|Tests|Worst Time Complexity|Worst Space Complexity
-----|-----|-----|:-----:|:-----:
2018-10-13 16:01:27 +00:00
[Binary Search](https://en.wikipedia.org/wiki/Binary_search_algorithm)|[BinarySearch.java](searching/src/main/java/com/wbrawner/algorithms/searching/BinarySearch.java)|[ParameterizedBinarySearchTest.java](searching/src/test/java/com/wbrawner/algorithms/searching/ParameterizedBinarySearchTest.java)|O(log n)|O(1)
2018-10-13 17:39:22 +00:00
[Fibonacci Search](https://en.wikipedia.org/wiki/Fibonacci_search_technique)|[FibonacciSearch.java](searching/src/main/java/com/wbrawner/algorithms/searching/FibonacciSearch.java)|[ParameterizedFibonacciSearchTest.java](searching/src/test/java/com/wbrawner/algorithms/searching/ParameterizedFibonacciSearchTest.java)|O(log n)|O(1)
2018-10-15 23:15:11 +00:00
[Jump Search](https://en.wikipedia.org/wiki/Jump_search)|[FibonacciSearch.java](searching/src/main/java/com/wbrawner/algorithms/searching/JumpSearch.java)|[ParameterizedJumpSearchTest.java](searching/src/test/java/com/wbrawner/algorithms/searching/ParameterizedJumpSearchTest.java)|O(√n)|O(1)
2018-10-13 15:43:47 +00:00
[Linear Search](https://en.wikipedia.org/wiki/Linear_search)|[LinearSearch.java](searching/src/main/java/com/wbrawner/algorithms/searching/LinearSearch.java)|[ParameterizedLinearSearchTest.java](searching/src/test/java/com/wbrawner/algorithms/searching/ParameterizedLinearSearchTest.java)|O(n)|O(1)
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-13 15:43:47 +00:00
-----|-----|-----|:-----:|:-----:
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-06 05:28:45 +00:00
[Selection Sort](https://en.wikipedia.org/wiki/Selection_sort)|[SelectionSort.java](sorting/src/main/java/com/wbrawner/algorithms/sorting/SelectionSort.java)|[ParameterizedSelectionSortTest.java](sorting/src/test/java/com/wbrawner/algorithms/sorting/ParameterizedSelectionSortTest.java)|O(n²)|O(1)
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-13 15:43:47 +00:00
- [Searching algorithms test data](searching/src/test/java/com/wbrawner/algorithms/searching/SearchData.java)
2018-10-06 04:43:33 +00:00
- [Sorting algorithms test data](sorting/src/test/java/com/wbrawner/algorithms/sorting/SortData.java)