Skip to content
Please note that GitHub no longer supports Internet Explorer.

We recommend upgrading to the latest Microsoft Edge, Google Chrome, or Firefox.

Learn more
Algorithms and Data Structures implemented in Java
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.settings
lib Converting the testing of the data structures to JUnit. Almost complete. Jun 13, 2014
src/com/jwetherell/algorithms Fixed a bug in the getHeadValue of the Heap structures Feb 21, 2019
test/com/jwetherell/algorithms Fixed a bug in the ArrayQueue iterator Feb 21, 2019
.classpath Moved all the test/timing related classes into test/ directory beside… Jan 14, 2016
.gitignore
.project
.travis.yml
LICENSE Initial commit Nov 20, 2013
PULL_REQUEST_TEMPLATE.md added pull request templete and little bit update in readme Apr 12, 2017
README.md Implementation of lowest common ancestor. Sep 5, 2017
build.xml

README.md

Java : Algorithms and Data Structure alt tag

Algorithms and Data Structures implemented in Java

This is a collection of algorithms and data structures which I've implement over the years in my academic and professional life. The code isn't overly-optimized but is written to be correct and readable. The algorithms and data structures are well tested and, unless noted, are believe to be 100% correct.

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

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)

Manacher's algorithm (Find the longest Palindrome)

KMP (Knuth–Morris–Pratt) Algorithm - Length of maximal prefix-suffix for each prefix

String rotations

  • Find in lexicographically minimal string rotation
  • Find in lexicographically maximal string rotation
You can’t perform that action at this time.