Skip to content

About

Algorithms and Data Structures implemented in Java

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

Java : Algorithms and Data Structure CI

The algorithms and data structures are implemented in Java.

This is a collection of algorithms and data structures I've implemented in my academic and professional life. The code isn't optimized but is written to be correct and readable. The algorithms and data structures are tested and, unless noted, believed to be correct.

Building and testing

The project is built with Maven and targets Java 25 (the current LTS), so building requires JDK 25 or newer. CI also builds and tests on Java 27, the latest feature release.

mvn test     # compile and run the test suite
mvn package  # build the jar

Benchmarks

The timing harnesses under test/**/timing/ are run through Maven profiles. Each one forks a separate JVM (-server -Xmx3g) so that the timings are not distorted by Maven's own JVM:

mvn -Pbenchmark-sorts test-compile exec:exec
mvn -Pbenchmark-data_structures test-compile exec:exec
mvn -Pbenchmark-spatial_data_structures test-compile exec:exec
mvn -Pbenchmark-mathematics test-compile exec:exec
mvn -Pbenchmark-numbers test-compile exec:exec
mvn -Pbenchmark-search test-compile exec:exec
mvn -Pbenchmark-sequences test-compile exec:exec
mvn -Pbenchmark-strings test-compile exec:exec

Created by Justin Wetherell

Support me with a donation

Donate to this project

What's been implemented:

Table of Contents

Data Structures

Mathematics

Numbers

  • Integers
    • to binary String
      • using divide and modulus
      • using right shift and modulus
      • using BigDecimal
      • using divide and double
    • is a power of 2
      • using a loop
      • using recursion
      • using logarithm
      • using bits
    • to English (e.g. 1 would return "one")
  • Longs
    • to binary String
      • using divide and modulus
      • using right shift and modulus
      • using BigDecimal
  • Complex
    • addition
    • subtraction
    • multiplication
    • absolute value
    • polar value

Graphs

Search

Sequences

Sorts

String Functions

  • Reverse characters in a string
    • using additional storage (a String or StringBuilder)
    • using in-place swaps
    • using in-place XOR
  • Reverse words in a string
    • using char swaps and additional storage (a StringBuilder)
    • using StringTokenizer and additional (a String)
    • using split() method and additional storage (a StringBuilder and String[])
    • using in-place swaps
  • Is Palindrome
    • using additional storage (a StringBuilder)
    • using in-place symetric element compares
  • Subsets of characters in a String
  • Edit (Levenshtein) Distance of two Strings (Recursive, Iterative)
  • Find in lexicographically minimal string rotation
  • Find in lexicographically maximal string rotation

About

Algorithms and Data Structures implemented in Java

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages