Kotlin-Algorithm icon indicating copy to clipboard operation
Kotlin-Algorithm copied to clipboard

Algorithms and data structures in kotlin

Welcome to Kotlin Algorithms

Here you'll find implementations of popular algorithms and data structures in Kotlin programming language.

This is a work in progress. More algorithms will be added soon. :-)

Suggestions and contributions are welcome!

The algorithms

Searching

  • Linear Search
  • Binary Search
  • [Count Occurrences]
  • [Select Minimum / Maximum]
  • [k-th Largest Element]
  • [Selection Sampling]
  • [Union-Find]
  • Depth-First Search

String Search

  • [Brute-Force String Search]
  • [Boyer-Moore]
  • Rabin-Karp
  • [Longest Common Subsequence]

Sorting

Basic sorts:

  • Insertion Sort
  • Selection Sort
  • Shell Sort

Fast sorts:

  • Quicksort
  • Merge Sort
  • [Heap Sort]

Special-purpose sorts:

  • Bucket Sort
  • Counting Sort
  • Radix Sort
  • [Topological Sort]

Compression

  • Run-Length Encoding (RLE)
  • [Huffman Coding]

Miscellaneous

  • Shuffle Randomly rearranges the contents of an array.

Machine learning

  • [k-Means Clustering]
  • k-Nearest Neighbors
  • Linear Regression
  • Logistic Regression
  • Neural Networks
  • PageRank

Data structures

Variations on arrays

  • [Array2D]
  • [Bit Set]
  • [Fixed Size Array]
  • [Ordered Array](Ordered Array/)

Queues

  • Stack
  • Queue
  • Deque
  • [Priority Queue]
  • [Bounded Priority Queue]
  • [Ring Buffer]

Lists

  • Linked List
  • Skip List

Trees

  • Tree
  • [Binary Tree]
  • [Binary Search Tree (BST)]
  • [AVL Tree]
  • Red-Black Tree
  • Splay Tree
  • Threaded Binary Tree
  • [Segment Tree]
  • kd-Tree
  • [Heap]
  • Fibonacci Heap
  • Trie
  • [B-Tree]

Hashing

  • [Hash Table]
  • Hash Functions

Sets

  • [Bloom Filter]
  • [Hash Set]
  • Multiset
  • Ordered Set

Graphs

  • [Graph]
  • [Breadth-First Search (BFS)]
  • [Depth-First Search (DFS)]
  • [Shortest Path]
  • [Minimum Spanning Tree]
  • All Paths

License

All content is licensed under the terms of the MIT open source license.

Contributors

Contact