A simple repository used to learn algorithms by coding them myself
Find a file
2018-10-15 18:15:11 -05:00
.idea Add Linear search algorithm 2018-10-13 10:43:47 -05:00
gradle/wrapper Add merge sort algorithm 2018-10-05 02:20:16 -05:00
searching Add Jump search algorithm 2018-10-15 18:15:11 -05:00
sorting Add Heapsort algorithm 2018-10-11 16:38:07 -05:00
build.gradle Add merge sort algorithm 2018-10-05 02:20:16 -05:00
gradlew Add merge sort algorithm 2018-10-05 02:20:16 -05:00
gradlew.bat Add merge sort algorithm 2018-10-05 02:20:16 -05:00
README.md Add Jump search algorithm 2018-10-15 18:15:11 -05:00
settings.gradle Add Linear search algorithm 2018-10-13 10:43:47 -05: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 out to me if you see something that could be improved upon. The complexity notations were taken primarily from the Big O Cheat Sheet

Searching

Algorithm Implementation Tests Worst Time Complexity Worst Space Complexity
Binary Search BinarySearch.java ParameterizedBinarySearchTest.java O(log n) O(1)
Fibonacci Search FibonacciSearch.java ParameterizedFibonacciSearchTest.java O(log n) O(1)
Jump Search FibonacciSearch.java ParameterizedJumpSearchTest.java O(√n) O(1)
Linear Search LinearSearch.java ParameterizedLinearSearchTest.java O(n) O(1)

Sorting

Algorithm Implementation Tests Worst Time Complexity Worst Space Complexity
Bubble Sort BubbleSort.java ParameterizedBubbleSortTest.java O(n²) O(1)
Insertion Sort InsertionSort.java ParameterizedInsertionSortTest.java O(n²) O(1)
Merge Sort MergeSort.java ParameterizedMergeSortTest.java O(n log(n)) O(n)
Selection Sort SelectionSort.java ParameterizedSelectionSortTest.java O(n²) O(1)

Building/Testing

./gradlew test

To keep things simple, the tests share the same data where possible.