Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/DmitryTsyvtsyn/Kotlin-Algorithms-and-Design-Patterns

This repository contains the most common algorithms and data structures written in the Kotlin language with simple and concise code.
https://github.com/DmitryTsyvtsyn/Kotlin-Algorithms-and-Design-Patterns

abstract-factory-pattern adapter-pattern algorithm algorithms algorithms-and-data-structures builder-pattern command-pattern data-structures decorator-pattern design-pattern design-patterns facade-pattern flyweight-pattern kotlin observer-pattern singleton-pattern strategy-pattern

Last synced: about 1 month ago
JSON representation

This repository contains the most common algorithms and data structures written in the Kotlin language with simple and concise code.

Awesome Lists containing this project

README

        

![Алгоритмы на Kotlin](/assets/algo_logo.png)

# Kotlin Algorithms and Design Patterns

This repository lists the most common algorithms, data structures, and design patterns written in the Kotlin programming language.

All code is divided into separate packages:

1. sorting - sorting algorithms
2. search - search algorithms
3. structures - data structure (lists, arrays, stack, queue, binary trees, e.t.c)
4. design-patterns - design patterns
5. other - other algorithms (Levenshtein distance, Knut Morris Pratt algorithm, e.t.c)

For each code file, tests are made, which are located in the test/kotlin directory

Also, whenever possible, I add *javadoc* for each class, method, and file

Content:

1. package design_patterns - design patterns
* [Abstract Factory](/src/main/kotlin/design_patterns/Abstract%20Factory.kt)
* [Adapter](/src/main/kotlin/design_patterns/Adapter.kt)
* [Bridge](/src/main/kotlin/design_patterns/Bridge.kt)
* [Builder](/src/main/kotlin/design_patterns/Builder.kt)
* [Chain Of Responsibilities](/src/main/kotlin/design_patterns/Сhain%20Of%20Responsibilities.kt)
* [Command](/src/main/kotlin/design_patterns/Command.kt)
* [Composite](/src/main/kotlin/design_patterns/Composite.kt)
* [Decorator](/src/main/kotlin/design_patterns/Decorator.kt)
* [Facade](/src/main/kotlin/design_patterns/Facade.kt)
* [Factory Method](/src/main/kotlin/design_patterns/Factory%20Method.kt)
* [Flyweight](/src/main/kotlin/design_patterns/Flyweight.kt)
* [Interpreter](/src/main/kotlin/design_patterns/Interpreter.kt)
* [Iterator](/src/main/kotlin/design_patterns/Iterator.kt)
* [Mediator](/src/main/kotlin/design_patterns/Mediator.kt)
* [Memento](/src/main/kotlin/design_patterns/Memento.kt)
* [Observer](/src/main/kotlin/design_patterns/Observer.kt)
* [Prototype](/src/main/kotlin/design_patterns/Prototype.kt)
* [Proxy](/src/main/kotlin/design_patterns/Proxy.kt)
* [Singleton](/src/main/kotlin/design_patterns/Singleton.kt)
* [State](/src/main/kotlin/design_patterns/State.kt)
* [Strategy](/src/main/kotlin/design_patterns/Strategy.kt)
* [Template Method](/src/main/kotlin/design_patterns/Template%20Method.kt)
* [Visitor](/src/main/kotlin/design_patterns/Visitor.kt)

2. package structures - data structure
* [Binary tree](/src/main/kotlin/structures/BinaryTree.kt)
* [Stack 1st implementation](/src/main/kotlin/structures/Stack1.kt)
* [Stack 2nd implementation](/src/main/kotlin/structures/Stack2.kt)
* [Queue](/src/main/kotlin/structures/Queue.kt)
* [Undirected Graph](/src/main/kotlin/structures/Graph.kt)
* [Directed Graph with weights](/src/main/kotlin/structures/GraphWithWeights.kt)
* [Matrix](/src/main/kotlin/structures/Matrix.kt)
* [Dynamic Array](/src/main/kotlin/structures/DynamicArray.kt)
* [Single linked list](/src/main/kotlin/structures/SingleLinkedList.kt)
* [Double linked list](/src/main/kotlin/structures/DoubleLinkedList.kt)
* [Min-heap](/src/main/kotlin/structures/MinHeap.kt)
* [Max-heap](/src/main/kotlin/structures/MaxHeap.kt)

3. package sorting - sorting algorithms
* [Bubble sort](/src/main/kotlin/sorting/BubbleSort.kt)
* [Insertion sort](/src/main/kotlin/sorting/InsertionSort.kt)
* [Merge sort](/src/main/kotlin/sorting/MergeSort.kt)
* [Quick sort](/src/main/kotlin/sorting/QuickSort.kt)
* [Selection sort](/src/main/kotlin/sorting/SelectionSort.kt)
* [Radix sort](/src/main/kotlin/sorting/RadixSort.kt)
* [Tim sort](/src/main/kotlin/sorting/TimSort.kt)
* [Count sort](/src/main/kotlin/sorting/CountingSort.kt)

4. package search - search algorithms
* [Binary search](/src/main/kotlin/search/BinarySearch.kt)
* [Linear search](/src/main/kotlin/search/LinearSearch.kt)

5. package other - other algorithms
* [Finite state machine](/src/main/kotlin/other/BinaryDigitsCounter.kt)
* [Euclid's algorithm](/src/main/kotlin/other/EuclidAlgorithm.kt)
* [Factorial](/src/main/kotlin/other/Factorial.kt)
* [Factorial from Google Guava library](/src/main/kotlin/other/FactorialAdvanced.kt)
* [Factorial of BigInteger's with cache](/src/main/kotlin/other/FactorialBigWithCache.kt)
* [Factorial with cache](/src/main/kotlin/other/FactorialWithCache.kt)
* [FizzBuzz](/src/main/kotlin/other/FizzBuzz.kt)
* [Knut Morris Pratt's Algorithm for finding a substring](/src/main/kotlin/other/KnuthMorrisPrattAlgorithm.kt)
* [Levenshtein distance](/src/main/kotlin/other/LevenshteinLengthAlgorithm.kt)
* [Finding the maximum](/src/main/kotlin/other/MaxAlgorithm.kt)
* [Finding the minimum](/src/main/kotlin/other/MinAlgorithm.kt)
* [Palindrome](/src/main/kotlin/other/PalindromeAlgorithm.kt)
* [Parenthesis checking algorithm](/src/main/kotlin/other/ParenthesisCheckAlgorithm.kt)
* [Reverse Array](/src/main/kotlin/other/ReverseArrayAlgorithm.kt)
* [Sieve of Eratosthenes](/src/main/kotlin/other/SieveOfEratosthenesAlgorithm.kt)
* [The square root of a number](/src/main/kotlin/other/Sqrt.kt)
* [StringEqualsHash](/src/main/kotlin/other/StringEqualsHashAlgorithm.kt)
* [Swap algorithm](/src/main/kotlin/other/SwapAlgorithm.kt)

## Your wishes and ideas

If you are interested in my repository or you have ideas on how to improve it or add something write: [Telegram](https://t.me/dmitry_tsyvtsyn), [Gmail](mailto:[email protected])

## License

MIT License

Copyright (c) 2023 Dmitry Tsyvtsyn

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.